Handle a few jobs scheduled at the same time

This commit is contained in:
Dzmitry Plashchynski
2015-04-08 20:08:58 +03:00
parent d075a55f03
commit b4ad8fb953
5 changed files with 38 additions and 27 deletions

View File

@@ -79,9 +79,10 @@ module Crono
end
def start_working_loop
while (job = Crono.scheduler.next)
sleep(job.next - Time.now)
job.perform
while true
next_time, jobs = Crono.scheduler.next_jobs
sleep(next_time - Time.now)
jobs.each(&:perform)
end
end