Skip to content

Commit 85ad122

Browse files
committed
Only run the protip mailer popular protips if the feature is enabled
1 parent f4604de commit 85ad122

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/clock.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
# On the first of every month send the popular protips from the previous month.
1919
every(1.day, 'protip_mailer:popular_protips', if: ->(t){ t.day == 1 }) do
20-
last_month = 1.month.ago
21-
ProtipMailerPopularProtipsWorker.perform_async(last_month.beginning_of_month, last_month.end_of_month)
20+
if ENV['PROTIP_MAILER_POPULAR_PROTIPS']
21+
last_month = 1.month.ago
22+
ProtipMailerPopularProtipsWorker.perform_async(last_month.beginning_of_month, last_month.end_of_month)
23+
else
24+
Rails.logger.warn('PROTIP_MAILER_POPULAR_PROTIPS is disabled. Set `heroku config:set PROTIP_MAILER_POPULAR_PROTIPS=true` to allow sending scheduled emails.')
25+
end
2226
end
2327

2428
every(1.day, 'cleanup:protips:associate_zombie_upvotes', at: '00:00') {}

0 commit comments

Comments
 (0)