mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-23 17:28:45 +02: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
|
def start_working_loop
|
||||||
loop do
|
loop do
|
||||||
next_time, jobs = Crono.scheduler.next_jobs
|
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)
|
jobs.each(&:perform)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user