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 false
end end
config :plausible, Oban, queues = if String.to_existing_atom(System.get_env("CRON_ENABLED", "false")) do
repo: Plausible.Repo, [
queues: [
provision_ssl_certificates: 1, provision_ssl_certificates: 1,
fetch_tweets: 1, fetch_tweets: 1,
check_stats_emails: 1, check_stats_emails: 1,
email_reports: 1, email_reports: 1,
site_setup_emails: 1, site_setup_emails: 1,
trial_notification_emails: 1 trial_notification_emails: 1
], ]
else
[]
end
config :plausible, Oban,
repo: Plausible.Repo,
queues: queues,
crontab: crontab crontab: crontab
config :plausible, :google, config :plausible, :google,

View File

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