diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-09-10 10:54:57 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-11-11 13:39:49 +0300 |
commit | 8d218ebaf5ab0b72e419068340c40a5ef9744924 (patch) | |
tree | 7d3187a7082da34e1dde2ae858312c078e0e5c9c /priv/repo/migrations/20200915095704_remove_background_jobs.exs | |
parent | 88f6b61a5e31856eb4cee204adf3fc9a6ab78d76 (diff) | |
download | pleroma-8d218ebaf5ab0b72e419068340c40a5ef9744924.tar.gz pleroma-8d218ebaf5ab0b72e419068340c40a5ef9744924.zip |
Moving some background jobs into simple tasks
- fetching activity data
- attachment prefetching
- using limiter to prevent overload
Diffstat (limited to 'priv/repo/migrations/20200915095704_remove_background_jobs.exs')
-rw-r--r-- | priv/repo/migrations/20200915095704_remove_background_jobs.exs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200915095704_remove_background_jobs.exs b/priv/repo/migrations/20200915095704_remove_background_jobs.exs new file mode 100644 index 000000000..9785bfb8a --- /dev/null +++ b/priv/repo/migrations/20200915095704_remove_background_jobs.exs @@ -0,0 +1,22 @@ +defmodule Pleroma.Repo.Migrations.RemoveBackgroundJobs do + use Ecto.Migration + + import Ecto.Query, only: [from: 2] + + def up do + from(j in "oban_jobs", + where: + j.queue == ^"background" and + fragment("?->>'op'", j.args) in ^[ + "fetch_data_for_activity", + "media_proxy_prefetch", + "media_proxy_preload" + ] and + j.worker == ^"Pleroma.Workers.BackgroundWorker", + select: [:id] + ) + |> Pleroma.Repo.delete_all() + end + + def down, do: :ok +end |