mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-18 23:44:27 +01:00
Merge pull request #80 from andrisbriedis/master
Fixed race condition when starting jobs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user