Merge pull request #80 from andrisbriedis/master

Fixed race condition when starting jobs
This commit is contained in:
Dzmitry Plashchynski authored and GitHub committed 2019-07-10 14:15:04 +03:00
commit 9b9193e1c8
1 file changed
+2 -1
+2 -1
View File
@@ -120,7 +120,8 @@ module Crono
def start_working_loop
loop do
next_time, jobs = Crono.scheduler.next_jobs
sleep(next_time - Time.zone.now) if next_time > Time.zone.now
now = Time.zone.now
sleep(next_time - now) if next_time > now
jobs.each(&:perform)
end
end