Hello,
We use Whenever on a large project with lots of scheduled tasks on different hours. For example at 9am :
every :day, at: '09:00am' do
runner 'MyClass1.task1'
runner 'MyClass2.task2'
...
runner 'MyClass10.task10'
end
The problem is that this creates 10 cron tasks at 9am, and lots of processes are spawned simultaneously and uses a lot of RAM.
So instead we would like to run a single cron task with 10 chained tasks.
I thought we could use the following syntax (untested) :
every :day, at: '09:00am' do
runner 'MyClass1.task1; MyClass2.task2'; ...; MyClass10.task10'
end
But this would make long lines and the code would hardly be readable.
We could also create a Ruby class, say "SchedulerTask" and create a static method , say "SchedulerTask.9am", and then use it the scheduler, but I find this not very elegant.
Is there any good practice to do that ? (I've search the issues, but couldn't find...)
Thank you for your help :)
Mathieu.
Hello,
We use Whenever on a large project with lots of scheduled tasks on different hours. For example at 9am :
The problem is that this creates 10 cron tasks at 9am, and lots of processes are spawned simultaneously and uses a lot of RAM.
So instead we would like to run a single cron task with 10 chained tasks.
I thought we could use the following syntax (untested) :
But this would make long lines and the code would hardly be readable.
We could also create a Ruby class, say "SchedulerTask" and create a static method , say "SchedulerTask.9am", and then use it the scheduler, but I find this not very elegant.
Is there any good practice to do that ? (I've search the issues, but couldn't find...)
Thank you for your help :)
Mathieu.