logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs (855B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.RemovePurgeExpiredActivityWorkerFromObanConfig do
  5. use Ecto.Migration
  6. def change do
  7. with %Pleroma.ConfigDB{} = config <-
  8. Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Oban}),
  9. crontab when is_list(crontab) <- config.value[:crontab],
  10. index when is_integer(index) <-
  11. Enum.find_index(crontab, fn {_, worker} ->
  12. worker == Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker
  13. end) do
  14. updated_value = Keyword.put(config.value, :crontab, List.delete_at(crontab, index))
  15. config
  16. |> Ecto.Changeset.change(value: updated_value)
  17. |> Pleroma.Repo.update()
  18. end
  19. end
  20. end