mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-26 07:52:17 +00:00
Cachex: Unify arity of callback function
This commit is contained in:
parent
ee81a94ab2
commit
c9d73af74d
|
@ -1091,7 +1091,7 @@ defmodule Pleroma.User do
|
||||||
def get_cached_by_nickname(nickname) do
|
def get_cached_by_nickname(nickname) do
|
||||||
key = "nickname:#{nickname}"
|
key = "nickname:#{nickname}"
|
||||||
|
|
||||||
@cachex.fetch!(:user_cache, key, fn ->
|
@cachex.fetch!(:user_cache, key, fn _ ->
|
||||||
case get_or_fetch_by_nickname(nickname) do
|
case get_or_fetch_by_nickname(nickname) do
|
||||||
{:ok, user} -> {:commit, user}
|
{:ok, user} -> {:commit, user}
|
||||||
{:error, _error} -> {:ignore, nil}
|
{:error, _error} -> {:ignore, nil}
|
||||||
|
|
|
@ -57,7 +57,7 @@ defmodule Pleroma.Web.MastodonAPI.PollController do
|
||||||
defp get_cached_vote_or_vote(user, object, choices) do
|
defp get_cached_vote_or_vote(user, object, choices) do
|
||||||
idempotency_key = "polls:#{user.id}:#{object.data["id"]}"
|
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
|
case CommonAPI.vote(user, object, choices) do
|
||||||
{:error, _message} = res -> {:ignore, res}
|
{:error, _message} = res -> {:ignore, res}
|
||||||
res -> {:commit, res}
|
res -> {:commit, res}
|
||||||
|
|
Loading…
Reference in a new issue