Merge branch 'simpler-oban-queues' into 'develop'
Oban queue simplification See merge request pleroma/pleroma!4123
This commit is contained in:
commit
38db406ce4
19 changed files with 63 additions and 34 deletions
32
priv/repo/migrations/20240527144418_oban_queues_refactor.exs
Normal file
32
priv/repo/migrations/20240527144418_oban_queues_refactor.exs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
defmodule Pleroma.Repo.Migrations.ObanQueuesRefactor do
|
||||
use Ecto.Migration
|
||||
|
||||
@changed_queues [
|
||||
{"attachments_cleanup", "slow"},
|
||||
{"mailer", "background"},
|
||||
{"mute_expire", "background"},
|
||||
{"poll_notifications", "background"},
|
||||
{"activity_expiration", "slow"},
|
||||
{"filter_expiration", "background"},
|
||||
{"token_expiration", "background"},
|
||||
{"remote_fetcher", "background"},
|
||||
{"rich_media_expiration", "background"}
|
||||
]
|
||||
|
||||
def up do
|
||||
Enum.each(@changed_queues, fn {old, new} ->
|
||||
execute("UPDATE oban_jobs SET queue = '#{new}' WHERE queue = '#{old}';")
|
||||
end)
|
||||
|
||||
# Handled special as reverting this would not be ideal and leaving it is harmless
|
||||
execute(
|
||||
"UPDATE oban_jobs SET queue = 'federator_outgoing' WHERE queue = 'scheduled_activities';"
|
||||
)
|
||||
end
|
||||
|
||||
def down do
|
||||
# Just move all slow queue jobs to background queue if we are reverting
|
||||
# as the slow queue will not be processing jobs
|
||||
execute("UPDATE oban_jobs SET queue = 'background' WHERE queue = 'slow';")
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue