Open assembler opened 11 years ago
or third option: refactor my app no to schedule tasks in intervals smaller than poll_sleep_amount
(5 seconds)
@assembler, Can you give a unit test in a PR against which we can program and implement this feature. Maybe we can give a an external configuration setting for the sleep interval.
This seems to be handled now, tasks are enqueued in a loop until no more timestamps currently have tasks: https://github.com/resque/resque-scheduler/blob/5d7a4e1d4ef33c37e9c05c9a91236e7ef12e1529/lib/resque/scheduler.rb#L189-L192
From reading the source, scheduler is going to handle_delayed_items each 5 seconds (sleep interval).
This method is going to take the next timestamp from the queue and process all tasks associated with that timestamp.
If i have huge amount of tasks which are scheduled (delayed) to be run like this:
Scheduler is going to run like this:
If these repeated tasks are infinite, scheduler will keep lagging more and more as the time passes.
I see two solutions to this:
handle_delayed_items
to keep looping untilnext_delayed_timestamp
reaches the current timestamp