[PR #80] [MERGED] Fixed race condition when starting jobs #94

Closed
opened 2025-12-29 00:22:33 +01:00 by adam · 0 comments
Owner

📋 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: masterHead: master


📝 Commits (1)

  • 6ca28ae Fixed 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.

## 📋 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>
adam added the pull-request label 2025-12-29 00:22:33 +01:00
adam closed this issue 2025-12-29 00:22:33 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/crono#94