Skip to content

Commit

Permalink
Merge pull request #80 from andrisbriedis/master
Browse files Browse the repository at this point in the history
Fixed race condition when starting jobs
  • Loading branch information
plashchynski authored Jul 10, 2019
2 parents 3344c43 + 6ca28ae commit 9b9193e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/crono/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def rails_root_defined?
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
Expand Down

0 comments on commit 9b9193e

Please sign in to comment.