summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2024-05-27 14:35:30 +0000
committerMark Felder <feld@feld.me>2024-05-27 13:48:17 -0400
commit0847d9ebafa38007aeef0a6677588211994ab546 (patch)
tree734adb44836ae35245fd62375a1ab86765c65bb6 /priv
parent6291bf22bdacd146ae1aa7546281a9fe0c745611 (diff)
downloadpleroma-0847d9ebafa38007aeef0a6677588211994ab546.tar.gz
pleroma-0847d9ebafa38007aeef0a6677588211994ab546.zip
Oban queue simplification
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