static-fe overhaul (#236)
[akkoma] / lib / pleroma / config / oban.ex
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
5 defmodule Pleroma.Config.Oban do
6 require Logger
7
8 def warn do
9 oban_config = Pleroma.Config.get(Oban)
10
11 crontab =
12 [
13 Pleroma.Workers.Cron.StatsWorker,
14 Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker,
15 Pleroma.Workers.Cron.ClearOauthTokenWorker
16 ]
17 |> Enum.reduce(oban_config[:crontab], fn removed_worker, acc ->
18 with acc when is_list(acc) <- acc,
19 setting when is_tuple(setting) <-
20 Enum.find(acc, fn {_, worker} -> worker == removed_worker end) do
21 """
22 !!!OBAN CONFIG WARNING!!!
23 You are using old workers in Oban crontab settings, which were removed.
24 Please, remove setting from crontab in your config file (prod.secret.exs): #{inspect(setting)}
25 """
26 |> Logger.warn()
27
28 List.delete(acc, setting)
29 else
30 _ -> acc
31 end
32 end)
33
34 Pleroma.Config.put(Oban, Keyword.put(oban_config, :crontab, crontab))
35 end
36 end