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.
## 📋 Pull Request Information
**Original PR:** https://github.com/plashchynski/crono/pull/80
**Author:** [@andrisbriedis](https://github.com/andrisbriedis)
**Created:** 7/10/2019
**Status:** ✅ Merged
**Merged:** 7/10/2019
**Merged by:** [@plashchynski](https://github.com/plashchynski)
**Base:** `master` ← **Head:** `master`
---
### 📝 Commits (1)
- [`6ca28ae`](https://github.com/plashchynski/crono/commit/6ca28ae01d6b9d73cef662309a863872c14526bf) Fixed race condition when starting jobs
### 📊 Changes
**1 file changed** (+2 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `lib/crono/cli.rb` (+2 -1)
</details>
### 📄 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.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 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.