diff options
author | lain <lain@soykaf.club> | 2018-05-05 11:15:57 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2018-05-05 11:15:57 +0200 |
commit | c464355d1ac7f9558aa50f7038035b9a47614822 (patch) | |
tree | d6a0ba34a419b8c11756fb5838fec811677210d6 /lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | |
parent | 762f6edc29a7a48e3a663e9bedec58e0036ff363 (diff) | |
download | pleroma-c464355d1ac7f9558aa50f7038035b9a47614822.tar.gz |
Idempotency: Use special cache, keep for 6 hours.
Diffstat (limited to 'lib/pleroma/web/mastodon_api/mastodon_api_controller.ex')
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index bbd16482a..2b4e9e72b 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -283,13 +283,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do {:ok, activity} = Cachex.get!( - :user_cache, - "idem:#{idempotency_key}", + :idempotency_cache, + idempotency_key, fallback: fn _ -> CommonAPI.post(user, params) end ) - Cachex.expire(:user_cache, "idem:#{idempotency_key}", :timer.seconds(5 * 60)) - render(conn, StatusView, "status.json", %{activity: activity, for: user, as: :activity}) end |