summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2024-05-27 19:02:53 +0000
committerfeld <feld@feld.me>2024-05-27 19:02:53 +0000
commit38db406ce4345b02f7248a8d3166ad21d3978e8d (patch)
tree4699496bd86580b5562eb210254c68dbc2072cfa /priv
parent121791882fc1b1f25e2a0a104ee9fde4e489e6ae (diff)
parentf63e44b8bc8e4e2f21fe21f1407a85d072dcab6d (diff)
downloadpleroma-38db406ce4345b02f7248a8d3166ad21d3978e8d.tar.gz
pleroma-38db406ce4345b02f7248a8d3166ad21d3978e8d.zip
Merge branch 'simpler-oban-queues' into 'develop'
Oban queue simplification See merge request pleroma/pleroma!4123
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20240527144418_oban_queues_refactor.exs32
1 files changed, 32 insertions, 0 deletions
diff --git a/priv/repo/migrations/20240527144418_oban_queues_refactor.exs b/priv/repo/migrations/20240527144418_oban_queues_refactor.exs
new file mode 100644
index 000000000..64ee28dfd
--- /dev/null
+++ b/priv/repo/migrations/20240527144418_oban_queues_refactor.exs
@@ -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