Moving some background jobs into simple tasks
- fetching activity data - attachment prefetching - using limiter to prevent overload
This commit is contained in:
parent
88f6b61a5e
commit
8d218ebaf5
11 changed files with 58 additions and 40 deletions
|
|
@ -3,9 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Workers.BackgroundWorker do
|
||||
alias Pleroma.Activity
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy
|
||||
|
||||
use Pleroma.Workers.WorkerHelper, queue: "background"
|
||||
|
||||
|
|
@ -32,19 +30,6 @@ defmodule Pleroma.Workers.BackgroundWorker do
|
|||
{:ok, User.Import.perform(String.to_atom(op), user, identifiers)}
|
||||
end
|
||||
|
||||
def perform(%Job{args: %{"op" => "media_proxy_preload", "message" => message}}) do
|
||||
MediaProxyWarmingPolicy.perform(:preload, message)
|
||||
end
|
||||
|
||||
def perform(%Job{args: %{"op" => "media_proxy_prefetch", "url" => url}}) do
|
||||
MediaProxyWarmingPolicy.perform(:prefetch, url)
|
||||
end
|
||||
|
||||
def perform(%Job{args: %{"op" => "fetch_data_for_activity", "activity_id" => activity_id}}) do
|
||||
activity = Activity.get_by_id(activity_id)
|
||||
Pleroma.Web.RichMedia.Helpers.perform(:fetch, activity)
|
||||
end
|
||||
|
||||
def perform(%Job{
|
||||
args: %{"op" => "move_following", "origin_id" => origin_id, "target_id" => target_id}
|
||||
}) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue