diff options
author | rinpatch <rinpatch@sdf.org> | 2019-09-12 22:10:15 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-09-12 22:10:15 +0300 |
commit | dabc4a00f5cf08dac75f701457a24fce8735175f (patch) | |
tree | fa2f16077bf4f972c870077955ed85fde3be2adf | |
parent | 769fb778d41df77c2514b5e3c663f3f624c0a266 (diff) | |
download | pleroma-dabc4a00f5cf08dac75f701457a24fce8735175f.tar.gz |
Put the cache with the right key when using a tracking function
-rw-r--r-- | lib/pleroma/plugs/cache.ex | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pleroma/plugs/cache.ex b/lib/pleroma/plugs/cache.ex index 42d77fc1f..50b534e7b 100644 --- a/lib/pleroma/plugs/cache.ex +++ b/lib/pleroma/plugs/cache.ex @@ -58,7 +58,8 @@ defmodule Pleroma.Plugs.Cache do cache_resp(conn, opts) {:ok, {content_type, body, tracking_fun_data}} -> - conn = opts.tracking_fun(conn, tracking_fun_data) + conn = opts.tracking_fun.(conn, tracking_fun_data) + send_cached(conn, {content_type, body}) {:ok, record} -> @@ -93,7 +94,6 @@ defmodule Pleroma.Plugs.Cache do ttl = Map.get(conn.assigns, :cache_ttl, opts.ttl) key = cache_key(conn, opts) content_type = content_type(conn) - record = {content_type, body} conn = unless opts[:tracking_fun] do @@ -101,7 +101,7 @@ defmodule Pleroma.Plugs.Cache do conn else tracking_fun_data = Map.get(conn.assigns, :tracking_fun_data, nil) - Cachex.put(:web_resp_cache, {content_type, body, tracking_fun_data}, record, ttl: ttl) + Cachex.put(:web_resp_cache, key, {content_type, body, tracking_fun_data}, ttl: ttl) opts.tracking_fun.(conn, tracking_fun_data) end |