cron
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -0,1 +1,13 @@ | ||
## [2.4.1](https://github.com/kelektiv/node-cron/compare/v2.4.0...v2.4.1) (2023-08-14) | ||
### 🐛 Bug Fixes | ||
* replace loop timeout by max match date ([#686](https://github.com/kelektiv/node-cron/issues/686)) ([c685c63](https://github.com/kelektiv/node-cron/commit/c685c63a6d7fa86d6c8afca29b536b9da24e824b)) | ||
### ⚙️ Continuous Integrations | ||
* **renovate:** configure renovate ([#683](https://github.com/kelektiv/node-cron/issues/683)) ([9dbe962](https://github.com/kelektiv/node-cron/commit/9dbe962fad1c8b1b020441bce84ab91b1a7b4415)) | ||
## [2.4.0](https://github.com/kelektiv/node-cron/compare/v2.3.0...v2.4.0) (2023-07-24) | ||
@@ -2,0 +14,0 @@ |
@@ -262,6 +262,10 @@ const CONSTRAINTS = [ | ||
// it shouldn't take more than 5 seconds to find the next execution time | ||
// being very generous with this. Throw error if it takes too long to find the next time to protect from | ||
// infinite loop. | ||
const timeout = Date.now() + 5000; | ||
/** | ||
* maximum match interval is 8 years: | ||
* crontab has '* * 29 2 *' and we are on 1 March 2096: | ||
* next matching time will be 29 February 2104 | ||
* source: https://github.com/cronie-crond/cronie/blob/0d669551680f733a4bdd6bab082a0b3d6d7f089c/src/cronnext.c#L401-L403 | ||
*/ | ||
const maxMatch = luxon.DateTime.now().plus({ years: 8 }); | ||
// determine next date | ||
@@ -271,7 +275,7 @@ while (true) { | ||
// hard stop if the current date is after the expected execution | ||
if (Date.now() > timeout) { | ||
// hard stop if the current date is after the maximum match interval | ||
if (date > maxMatch) { | ||
throw new Error( | ||
`Something went wrong. It took over five seconds to find the next execution time for the cron job. | ||
Please refer to the canonical issue (https://github.com/kelektiv/node-cron/issues/467) and provide the following string if you would like to help debug: | ||
`Something went wrong. No execution date was found in the next 8 years. | ||
Please provide the following string if you would like to help debug: | ||
Time Zone: ${zone || '""'} - Cron String: ${this} - UTC offset: ${date.offset} | ||
@@ -278,0 +282,0 @@ - current Date: ${luxon.DateTime.local().toString()}` |
{ | ||
"name": "cron", | ||
"description": "Cron jobs for your node", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"author": "Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
59248
1117