Module: Octo::Scheduler
- Defined in:
- lib/octocore-mongo/scheduler.rb
Instance Method Summary collapse
-
#schedule_baseline ⇒ Object
Schedules the processing of baselines.
-
#schedule_counters ⇒ Object
Setup the schedules for counters.
-
#schedule_subscribermail ⇒ Object
Schedules the daily mail, to be sent at noon.
Instance Method Details
#schedule_baseline ⇒ Object
Schedules the processing of baselines
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/octocore-mongo/scheduler.rb', line 36 def schedule_baseline baseline_classes = [ Octo::ProductBaseline, Octo::CategoryBaseline, Octo::TagBaseline ] baseline_classes.each do |clazz| clazz.send(:get_typecounters).each do |counter| name = [clazz, counter].join('::') config = { class: clazz.to_s, args: [counter], cron: '* * * * *', persists: true, queue: 'baseline_processing' } Resque.set_schedule name, config end end end |
#schedule_counters ⇒ Object
Setup the schedules for counters.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/octocore-mongo/scheduler.rb', line 13 def schedule_counters counter_classes = [ Octo::ProductHit, Octo::CategoryHit, Octo::TagHit, Octo::ApiHit, Octo::NewsfeedHit ] counter_classes.each do |clazz| clazz.send(:get_typecounters).each do |counter| name = [clazz, counter].join('::') config = { class: clazz.to_s, args: [counter], cron: '* * * * *', persist: true, queue: 'high' } Resque.set_schedule name, config end end # Schedules the processing of baselines def schedule_baseline baseline_classes = [ Octo::ProductBaseline, Octo::CategoryBaseline, Octo::TagBaseline ] baseline_classes.each do |clazz| clazz.send(:get_typecounters).each do |counter| name = [clazz, counter].join('::') config = { class: clazz.to_s, args: [counter], cron: '* * * * *', persists: true, queue: 'baseline_processing' } Resque.set_schedule name, config end end end # Schedules the daily mail, to be sent at noon def schedule_subscribermail name = 'SubscriberDailyMailer' config = { class: Octo::Mailer::SubscriberMailer, args: [], cron: '0 0 * * *', persist: true, queue: 'subscriber_notifier' } Resque.set_schedule name, config end end |
#schedule_subscribermail ⇒ Object
Schedules the daily mail, to be sent at noon
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/octocore-mongo/scheduler.rb', line 58 def schedule_subscribermail name = 'SubscriberDailyMailer' config = { class: Octo::Mailer::SubscriberMailer, args: [], cron: '0 0 * * *', persist: true, queue: 'subscriber_notifier' } Resque.set_schedule name, config end |