activitypub: move post rich media fetching to job queue
authorWilliam Pitcock <nenolod@dereferenced.org>
Mon, 13 May 2019 02:02:00 +0000 (02:02 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Mon, 13 May 2019 19:36:00 +0000 (19:36 +0000)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/rich_media/helpers.ex

index 11777c220cf522318a5150b70386c8f310bfcbef..d7c0ab4d3eaecfd39348849f020eeea74ef49075 100644 (file)
@@ -133,9 +133,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
           activity
         end
 
-      Task.start(fn ->
-        Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
-      end)
+      PleromaJobQueue.enqueue(:background, Pleroma.Web.RichMedia.Helpers, [:fetch, activity])
 
       Notification.create_notifications(activity)
 
index f67aaf58b655af4cfbe714f0b9b9810aacc2585c..0162a5be9d99c9093ce0f9e108b8b4961bbd6da5 100644 (file)
@@ -34,4 +34,6 @@ defmodule Pleroma.Web.RichMedia.Helpers do
   end
 
   def fetch_data_for_activity(_), do: %{}
+
+  def perform(:fetch, %Activity{} = activity), do: fetch_data_for_activity(activity)
 end