mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-17 12:36:11 +00:00
Get users fresh, might so we don't make new keys all the time.
This commit is contained in:
parent
bb1d08a47c
commit
a173fb9e41
|
@ -123,6 +123,10 @@ defmodule Pleroma.User 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 @@ defmodule Pleroma.Web.WebFinger 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