|
5 | 5 |
|
6 | 6 | include Clockwork
|
7 | 7 |
|
| 8 | +# On the first of every month send the popular protips from the previous month. |
| 9 | +every(1.day, 'protip_mailer:popular_protips', if: ->(t){ t.day == 1 }) do |
| 10 | + if ENV['PROTIP_MAILER_POPULAR_PROTIPS'] |
| 11 | + last_month = 1.month.ago |
| 12 | + ProtipMailerPopularProtipsWorker.perform_async(last_month.beginning_of_month, last_month.end_of_month) |
| 13 | + else |
| 14 | + Rails.logger.warn('PROTIP_MAILER_POPULAR_PROTIPS is disabled. Set `heroku config:set PROTIP_MAILER_POPULAR_PROTIPS=true` to allow sending scheduled emails.') |
| 15 | + end |
| 16 | +end |
8 | 17 |
|
9 |
| -# Runs as 1:01 AM Pacific |
10 |
| -every(1.day, 'award:activate:active', at: '01:01') do |
11 |
| - ActivatePendingUsersWorker.perform_async |
| 18 | +every(1.day, 'teams:refresh', at: '22:00') do |
| 19 | + TeamsRefreshJob.perform_async |
12 | 20 | end
|
13 | 21 |
|
14 | 22 | every(1.day, 'award:refresh:stale', at: '00:00') do
|
15 | 23 | RefreshStaleUsersWorker.perform_async
|
16 | 24 | end
|
17 | 25 |
|
18 |
| -# On the first of every month send the popular protips from the previous month. |
19 |
| -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) |
| 26 | +# Runs as 1:00 AM Pacific |
| 27 | +every(1.day, 'award:activate:active', at: '01:00') do |
| 28 | + ActivatePendingUsersWorker.perform_async |
| 29 | +end |
| 30 | + |
| 31 | +every(1.day, 'cleanup:protips:associate_zombie_upvotes', at: '02:00') do |
| 32 | + CleanupProtipsAssociateZombieUpvotesJob.perform_async |
| 33 | +end |
| 34 | + |
| 35 | +every(1.day, 'search:sync', at: '03:00') do |
| 36 | + SearchSyncJob.perform_async |
| 37 | +end |
| 38 | + |
| 39 | +every(1.day, 'protips:recalculate_scores', at: '04:00') do |
| 40 | + ProtipsRecalculateScoresJob.perform_async |
| 41 | +end |
| 42 | + |
| 43 | +every(1.day, 'clear_expired_sessions', at: '05:00') do |
| 44 | + ClearExpiredSessionsJob.perform_async |
22 | 45 | end
|
23 | 46 |
|
24 |
| -every(1.day, 'cleanup:protips:associate_zombie_upvotes', at: '00:00') {} |
25 |
| -every(1.day, 'clear_expired_sessions', at: '00:00') {} |
26 |
| -every(1.day, 'facts:system', at: '00:00') {} |
27 |
| -every(1.day, 'protips:recalculate_scores', at: '00:00') {} |
28 |
| -every(1.day, 'search:sync', at: '00:00') {} |
29 |
| -every(1.day, 'teams:refresh', at: '00:00') {} |
| 47 | +# This is tied with broken code. Probably should delete |
| 48 | +# every(1.day, 'facts:system', at: '00:00') {} |
0 commit comments