Fix the issue with get_by_nickname never being called

This commit is contained in:
rinpatch 2019-01-17 19:00:08 +03:00
parent 3b18789684
commit 388ceb6a7d
1 changed files with 7 additions and 2 deletions

View File

@ -449,8 +449,13 @@ def get_cached_by_id(id) do
ap_id =
Cachex.fetch!(:user_cache, key, fn _ ->
user = get_by_id(id)
Cachex.put(:user_cache, "ap_id:#{user.ap_id}", user)
{:commit, user.ap_id}
if user do
Cachex.put(:user_cache, "ap_id:#{user.ap_id}", user)
{:commit, user.ap_id}
else
{:ignore, ""}
end
end)
get_cached_by_ap_id(ap_id)