mirror of
https://github.com/plashchynski/crono.git
synced 2026-01-13 22:03:27 +01:00
[PR #80] [MERGED] Fixed race condition when starting jobs #94
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/plashchynski/crono/pull/80
Author: @andrisbriedis
Created: 7/10/2019
Status: ✅ Merged
Merged: 7/10/2019
Merged by: @plashchynski
Base:
master← Head:master📝 Commits (1)
6ca28aeFixed race condition when starting jobs📊 Changes
1 file changed (+2 additions, -1 deletions)
View changed files
📝
lib/crono/cli.rb(+2 -1)📄 Description
Calling Time.zone.now in the if statement and while calculating sleep delay sometimes resulted in an exception with message "time interval must be positive".
This happened if job was about to start and we needed to sleep for a really short period of time + server was under high load.
First the application was checking if difference between current time and scheduled run time was positive.
If the expression returned true, sleep was called, but required delay was calculated once again and could result in a negative value being passed to the sleep function.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.