Cachex: Unify arity of callback function

This commit is contained in:
lain 2020-12-21 12:03:58 +01:00
parent ee81a94ab2
commit c9d73af74d
2 changed files with 2 additions and 2 deletions
lib/pleroma
user.ex
web/mastodon_api/controllers

View file

@ -1091,7 +1091,7 @@ def get_cached_by_id(id) do
def get_cached_by_nickname(nickname) do
key = "nickname:#{nickname}"
@cachex.fetch!(:user_cache, key, fn ->
@cachex.fetch!(:user_cache, key, fn _ ->
case get_or_fetch_by_nickname(nickname) do
{:ok, user} -> {:commit, user}
{:error, _error} -> {:ignore, nil}

View file

@ -57,7 +57,7 @@ def vote(%{assigns: %{user: user}, body_params: %{choices: choices}} = conn, %{i
defp get_cached_vote_or_vote(user, object, choices) do
idempotency_key = "polls:#{user.id}:#{object.data["id"]}"
@cachex.fetch!(:idempotency_cache, idempotency_key, fn ->
@cachex.fetch!(:idempotency_cache, idempotency_key, fn _ ->
case CommonAPI.vote(user, object, choices) do
{:error, _message} = res -> {:ignore, res}
res -> {:commit, res}