Don't execute queues when cron_enabled=false

This commit is contained in:
Uku Taht 2020-06-07 21:42:20 +03:00
parent 8923a35903
commit cc673b88df
2 changed files with 20 additions and 12 deletions

View File

@ -97,16 +97,22 @@ else
false
end
config :plausible, Oban,
repo: Plausible.Repo,
queues: [
queues = if String.to_existing_atom(System.get_env("CRON_ENABLED", "false")) do
[
provision_ssl_certificates: 1,
fetch_tweets: 1,
check_stats_emails: 1,
email_reports: 1,
site_setup_emails: 1,
trial_notification_emails: 1
],
]
else
[]
end
config :plausible, Oban,
repo: Plausible.Repo,
queues: queues,
crontab: crontab
config :plausible, :google,

View File

@ -144,16 +144,18 @@ crontab = [
{"*/10 * * * *", Plausible.Workers.ProvisionSslCertificates}, # Every 10 minutes
]
config :plausible, Oban,
repo: Plausible.Repo,
queues: [
queues = [
provision_ssl_certificates: 1,
fetch_tweets: 1,
check_stats_emails: 1,
email_reports: 1,
site_setup_emails: 1,
trial_notification_emails: 1
],
]
config :plausible, Oban,
repo: Plausible.Repo,
queues: if cron_enabled, do: queues, else: []
crontab: if cron_enabled, do: crontab, else: false
config :logger, level: :warn