Fix digest email processing, consolidate Oban queues

The email related jobs can all share a single Oban queue
This commit is contained in:
Mark Felder 2023-11-07 15:11:14 -05:00
parent 4c5b45ed73
commit bf426c53b4
5 changed files with 12 additions and 3 deletions

View File

@ -0,0 +1 @@
Fix the processing of email digest jobs.

View File

@ -590,7 +590,6 @@ config :pleroma, Oban,
background: 5, background: 5,
remote_fetcher: 2, remote_fetcher: 2,
attachments_cleanup: 1, attachments_cleanup: 1,
new_users_digest: 1,
mute_expire: 5 mute_expire: 5
], ],
plugins: [Oban.Plugins.Pruner], plugins: [Oban.Plugins.Pruner],

View File

@ -7,7 +7,7 @@ defmodule Pleroma.Workers.Cron.DigestEmailsWorker do
The worker to send digest emails. The worker to send digest emails.
""" """
use Oban.Worker, queue: "digest_emails" use Oban.Worker, queue: "mailer"
alias Pleroma.Config alias Pleroma.Config
alias Pleroma.Emails alias Pleroma.Emails

View File

@ -9,7 +9,7 @@ defmodule Pleroma.Workers.Cron.NewUsersDigestWorker do
import Ecto.Query import Ecto.Query
use Pleroma.Workers.WorkerHelper, queue: "new_users_digest" use Pleroma.Workers.WorkerHelper, queue: "mailer"
@impl Oban.Worker @impl Oban.Worker
def perform(_job) do def perform(_job) do

View File

@ -0,0 +1,9 @@
defmodule Pleroma.Repo.Migrations.ConsolidateEmailQueues do
use Ecto.Migration
def change do
execute(
"UPDATE oban_jobs SET queue = 'mailer' WHERE queue in ('digest_emails', 'new_users_digest')"
)
end
end