@@ -284,66 +284,73 @@ config :plausible, PlausibleWeb.Firewall,
284284 |> String . split ( "," )
285285 |> Enum . map ( & String . trim / 1 )
286286
287- if config_env ( ) == :prod && ! disable_cron do
288- base_cron = [
289- # Daily at midnight
290- { "0 0 * * *" , Plausible.Workers.RotateSalts } ,
291- # hourly
292- { "0 * * * *" , Plausible.Workers.ScheduleEmailReports } ,
293- # hourly
294- { "0 * * * *" , Plausible.Workers.SendSiteSetupEmails } ,
295- # Daily at midday
296- { "0 12 * * *" , Plausible.Workers.SendCheckStatsEmails } ,
297- # Every 15 minutes
298- { "*/15 * * * *" , Plausible.Workers.SpikeNotifier } ,
299- # Every day at midnight
300- { "0 0 * * *" , Plausible.Workers.CleanEmailVerificationCodes } ,
301- # Every day at 1am
302- { "0 1 * * *" , Plausible.Workers.CleanInvitations }
303- ]
287+ cond do
288+ config_env ( ) == :prod && ! disable_cron ->
289+ base_cron = [
290+ # Daily at midnight
291+ { "0 0 * * *" , Plausible.Workers.RotateSalts } ,
292+ # hourly
293+ { "0 * * * *" , Plausible.Workers.ScheduleEmailReports } ,
294+ # hourly
295+ { "0 * * * *" , Plausible.Workers.SendSiteSetupEmails } ,
296+ # Daily at midday
297+ { "0 12 * * *" , Plausible.Workers.SendCheckStatsEmails } ,
298+ # Every 15 minutes
299+ { "*/15 * * * *" , Plausible.Workers.SpikeNotifier } ,
300+ # Every day at midnight
301+ { "0 0 * * *" , Plausible.Workers.CleanEmailVerificationCodes } ,
302+ # Every day at 1am
303+ { "0 1 * * *" , Plausible.Workers.CleanInvitations }
304+ ]
304305
305- extra_cron = [
306- # Daily at midday
307- { "0 12 * * *" , Plausible.Workers.SendTrialNotifications } ,
308- # Daily at 14
309- { "0 14 * * *" , Plausible.Workers.CheckUsage } ,
310- # Daily at 15
311- { "0 15 * * *" , Plausible.Workers.NotifyAnnualRenewal } ,
312- # Every midnight
313- { "0 0 * * *" , Plausible.Workers.LockSites }
314- ]
306+ extra_cron = [
307+ # Daily at midday
308+ { "0 12 * * *" , Plausible.Workers.SendTrialNotifications } ,
309+ # Daily at 14
310+ { "0 14 * * *" , Plausible.Workers.CheckUsage } ,
311+ # Daily at 15
312+ { "0 15 * * *" , Plausible.Workers.NotifyAnnualRenewal } ,
313+ # Every midnight
314+ { "0 0 * * *" , Plausible.Workers.LockSites }
315+ ]
315316
316- base_queues = [
317- rotate_salts: 1 ,
318- schedule_email_reports: 1 ,
319- send_email_reports: 1 ,
320- spike_notifications: 1 ,
321- check_stats_emails: 1 ,
322- site_setup_emails: 1 ,
323- clean_email_verification_codes: 1 ,
324- clean_invitations: 1 ,
325- google_analytics_imports: 1
326- ]
317+ base_queues = [
318+ rotate_salts: 1 ,
319+ schedule_email_reports: 1 ,
320+ send_email_reports: 1 ,
321+ spike_notifications: 1 ,
322+ check_stats_emails: 1 ,
323+ site_setup_emails: 1 ,
324+ clean_email_verification_codes: 1 ,
325+ clean_invitations: 1 ,
326+ google_analytics_imports: 1
327+ ]
327328
328- extra_queues = [
329- provision_ssl_certificates: 1 ,
330- trial_notification_emails: 1 ,
331- check_usage: 1 ,
332- notify_annual_renewal: 1 ,
333- lock_sites: 1
334- ]
329+ extra_queues = [
330+ provision_ssl_certificates: 1 ,
331+ trial_notification_emails: 1 ,
332+ check_usage: 1 ,
333+ notify_annual_renewal: 1 ,
334+ lock_sites: 1
335+ ]
335336
336- # Keep 30 days history
337- config :plausible , Oban ,
338- repo: Plausible.Repo ,
339- plugins: [ { Oban.Plugins.Pruner , max_age: 2_592_000 } ] ,
340- queues: if ( is_selfhost , do: base_queues , else: base_queues ++ extra_queues ) ,
341- crontab: if ( is_selfhost , do: base_cron , else: base_cron ++ extra_cron )
342- else
343- config :plausible , Oban ,
344- repo: Plausible.Repo ,
345- queues: [ google_analytics_imports: 1 ] ,
346- plugins: false
337+ # Keep 30 days history
338+ config :plausible , Oban ,
339+ repo: Plausible.Repo ,
340+ plugins: [ { Oban.Plugins.Pruner , max_age: 2_592_000 } ] ,
341+ queues: if ( is_selfhost , do: base_queues , else: base_queues ++ extra_queues ) ,
342+ crontab: if ( is_selfhost , do: base_cron , else: base_cron ++ extra_cron )
343+
344+ config_env ( ) == :test ->
345+ config :plausible , Oban ,
346+ repo: Plausible.Repo ,
347+ testing: :inline
348+
349+ true ->
350+ config :plausible , Oban ,
351+ repo: Plausible.Repo ,
352+ queues: [ google_analytics_imports: 1 ] ,
353+ plugins: [ ]
347354end
348355
349356config :plausible , :hcaptcha ,
0 commit comments