Send salmons and websub in background tasks.
authorRoger Braun <roger@rogerbraun.net>
Fri, 5 May 2017 18:38:10 +0000 (20:38 +0200)
committerRoger Braun <roger@rogerbraun.net>
Fri, 5 May 2017 18:38:10 +0000 (20:38 +0200)
lib/pleroma/web/salmon/salmon.ex
lib/pleroma/web/websub/websub.ex

index b95ad48ad3fdf94432d86235ee0d6f8d727ae07e..b4f81b4edfdf41a7e80472f431b77a1e78bc71ac 100644 (file)
@@ -150,8 +150,10 @@ defmodule Pleroma.Web.Salmon do
 
       remote_users(activity)
       |> Enum.each(fn(remote_user) ->
-        Logger.debug(fn -> "sending salmon to #{remote_user.ap_id}" end)
-        send_to_user(remote_user, feed, poster)
+        Task.start(fn ->
+          Logger.debug(fn -> "sending salmon to #{remote_user.ap_id}" end)
+          send_to_user(remote_user, feed, poster)
+        end)
       end)
     end
   end
index 7bdb778ad0621eb4608aab2a3328eb4058b21ece..a5abc303c1feb1e2f533b13a863d3fa3664ad6f1 100644 (file)
@@ -51,10 +51,12 @@ defmodule Pleroma.Web.Websub do
       signature = sign(sub.secret || "", response)
       Logger.debug(fn -> "Pushing to #{sub.callback}" end)
 
-      @httpoison.post(sub.callback, response, [
-            {"Content-Type", "application/atom+xml"},
-            {"X-Hub-Signature", "sha1=#{signature}"}
-          ])
+      Task.start(fn ->
+        @httpoison.post(sub.callback, response, [
+              {"Content-Type", "application/atom+xml"},
+              {"X-Hub-Signature", "sha1=#{signature}"}
+            ])
+      end)
     end)
   end