Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1KB

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Config.Oban do
  5. require Logger
  6. def warn do
  7. oban_config = Pleroma.Config.get(Oban)
  8. crontab =
  9. [
  10. Pleroma.Workers.Cron.StatsWorker,
  11. Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker,
  12. Pleroma.Workers.Cron.ClearOauthTokenWorker
  13. ]
  14. |> Enum.reduce(oban_config[:crontab], fn removed_worker, acc ->
  15. with acc when is_list(acc) <- acc,
  16. setting when is_tuple(setting) <-
  17. Enum.find(acc, fn {_, worker} -> worker == removed_worker end) do
  18. """
  19. !!!OBAN CONFIG WARNING!!!
  20. You are using old workers in Oban crontab settings, which were removed.
  21. Please, remove setting from crontab in your config file (prod.secret.exs): #{
  22. inspect(setting)
  23. }
  24. """
  25. |> Logger.warn()
  26. List.delete(acc, setting)
  27. else
  28. _ -> acc
  29. end
  30. end)
  31. Pleroma.Config.put(Oban, Keyword.put(oban_config, :crontab, crontab))
  32. end
  33. end