Create a DeleteWorker and change user and instance deletion jobs to use it

These deletion tasks are slow, but the other background jobs are not. This
will allow us to have a lower timeout on the normal background jobs.
This commit is contained in:
Mark Felder 2024-07-15 11:58:07 -04:00
commit 30defb1674
4 changed files with 29 additions and 14 deletions

View file

@ -10,7 +10,7 @@ defmodule Pleroma.Instances.Instance do
alias Pleroma.Maps
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Workers.BackgroundWorker
alias Pleroma.Workers.DeleteWorker
use Ecto.Schema
@ -297,7 +297,7 @@ defmodule Pleroma.Instances.Instance do
all of those users' activities and notifications.
"""
def delete_users_and_activities(host) when is_binary(host) do
BackgroundWorker.enqueue("delete_instance", %{"host" => host})
DeleteWorker.enqueue("delete_instance", %{"host" => host})
end
def perform(:delete_instance, host) when is_binary(host) do