diff options
author | eal <eal@waifu.club> | 2018-01-16 15:31:03 +0200 |
---|---|---|
committer | eal <eal@waifu.club> | 2018-01-16 15:31:03 +0200 |
commit | b3e7d7ae6d4ab4b871ecf18706461945fd148a1b (patch) | |
tree | 499bf53955d6a21f92ce2010e3e62f79438cbff6 /lib | |
parent | 80f6ac412a632da090be9f3d86971eac0b95a53d (diff) | |
download | pleroma-b3e7d7ae6d4ab4b871ecf18706461945fd148a1b.tar.gz |
Fetch external profile in the background.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api.ex | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index d04a81cd4..faecebde0 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -316,10 +316,12 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do def get_external_profile(for_user, uri) do with {:ok, %User{} = user} <- OStatus.find_or_make_user(uri) do - with url <- user.info["topic"], - {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do - OStatus.handle_incoming(body) - end + spawn(fn -> + with url <- user.info["topic"], + {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do + OStatus.handle_incoming(body) + end + end) {:ok, UserView.render("show.json", %{user: user, for: for_user})} else _e -> {:error, "Couldn't find user"} |