forked from AkkomaGang/akkoma
Get users fresh, might so we don't make new keys all the time.
This commit is contained in:
parent
bb1d08a47c
commit
a173fb9e41
2 changed files with 5 additions and 1 deletions
|
@ -123,6 +123,10 @@ def get_cached_by_nickname(nickname) do
|
|||
Cachex.get!(:user_cache, key, fallback: fn(_) -> Repo.get_by(User, nickname: nickname) end)
|
||||
end
|
||||
|
||||
def get_cached_by_nickname(nickname) do
|
||||
Repo.get_by(User, nickname: nickname)
|
||||
end
|
||||
|
||||
def get_cached_user_info(user) do
|
||||
key = "user_info:#{user.id}"
|
||||
Cachex.get!(:user_cache, key, fallback: fn(_) -> user_info(user) end)
|
||||
|
|
|
@ -20,7 +20,7 @@ def webfinger(resource) do
|
|||
regex = ~r/(acct:)?(?<username>\w+)@#{host}/
|
||||
case Regex.named_captures(regex, resource) do
|
||||
%{"username" => username} ->
|
||||
user = User.get_cached_by_nickname(username)
|
||||
user = User.get_by_nickname(username)
|
||||
{:ok, represent_user(user)}
|
||||
_ -> nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue