Moving some background jobs into simple tasks

- fetching activity data
- attachment prefetching
- using limiter to prevent overload
This commit is contained in:
Alexander Strizhakov 2020-09-10 10:54:57 +03:00
commit 8d218ebaf5
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
11 changed files with 58 additions and 40 deletions

View file

@ -24,7 +24,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.Push
alias Pleroma.Web.Streamer
alias Pleroma.Workers.BackgroundWorker
require Logger
@ -191,7 +190,9 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
Object.increase_replies_count(in_reply_to)
end
BackgroundWorker.enqueue("fetch_data_for_activity", %{"activity_id" => activity.id})
ConcurrentLimiter.limit(Pleroma.Web.RichMedia.Helpers, fn ->
Task.start(fn -> Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) end)
end)
meta =
meta