Send salmons and websub in background tasks.
This commit is contained in:
parent
7752f103f6
commit
04f6ece99e
|
@ -150,8 +150,10 @@ def publish(%{info: %{"keys" => keys}} = user, activity, poster) do
|
||||||
|
|
||||||
remote_users(activity)
|
remote_users(activity)
|
||||||
|> Enum.each(fn(remote_user) ->
|
|> Enum.each(fn(remote_user) ->
|
||||||
Logger.debug(fn -> "sending salmon to #{remote_user.ap_id}" end)
|
Task.start(fn ->
|
||||||
send_to_user(remote_user, feed, poster)
|
Logger.debug(fn -> "sending salmon to #{remote_user.ap_id}" end)
|
||||||
|
send_to_user(remote_user, feed, poster)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,10 +51,12 @@ def publish(topic, user, activity) do
|
||||||
signature = sign(sub.secret || "", response)
|
signature = sign(sub.secret || "", response)
|
||||||
Logger.debug(fn -> "Pushing to #{sub.callback}" end)
|
Logger.debug(fn -> "Pushing to #{sub.callback}" end)
|
||||||
|
|
||||||
@httpoison.post(sub.callback, response, [
|
Task.start(fn ->
|
||||||
{"Content-Type", "application/atom+xml"},
|
@httpoison.post(sub.callback, response, [
|
||||||
{"X-Hub-Signature", "sha1=#{signature}"}
|
{"Content-Type", "application/atom+xml"},
|
||||||
])
|
{"X-Hub-Signature", "sha1=#{signature}"}
|
||||||
|
])
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue