Currently I run this code:
every 1.day, at: '2am' do
rake 'data:load_direct_monitoring_statistics'
end if @environment == 'production'
every 1.day, at: '2pm' do
rake 'data:load_direct_monitoring_statistics'
end if @environment == 'production'
This code works as intended, but: is there a way to use just one cron declaration to cover both cases?
According to test in whenever repository you should be able to pass Array
every "weekday", :at => %w(5:02am 3:52pm) do
Here is the source> https://github.com/javan/whenever/blob/334cfa01f373006cc032e23907b1777a8ea3f3b0/test/functional/output_at_test.rb
So in you case it should be ok to do like
every 1.day, at: ['2am','2pm'] do
rake 'data:load_direct_monitoring_statistics'
end if @environment == 'production'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With