cron 3.0.0-beta.1 → 3.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## [3.0.0-beta.2](https://github.com/kelektiv/node-cron/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2023-08-15)
2
+
3
+
4
+ ### 🐛 Bug Fixes
5
+
6
+ * 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))
7
+
8
+
9
+ ### 🚨 Tests
10
+
11
+ * update new test for cron standard alignments ([ea56fc1](https://github.com/kelektiv/node-cron/commit/ea56fc1c32905d711b160823fc09f39169dd3efd))
12
+
13
+
14
+ ### ⚙️ Continuous Integrations
15
+
16
+ * **renovate:** configure renovate ([#683](https://github.com/kelektiv/node-cron/issues/683)) ([9dbe962](https://github.com/kelektiv/node-cron/commit/9dbe962fad1c8b1b020441bce84ab91b1a7b4415))
17
+
1
18
  ## [3.0.0-beta.1](https://github.com/kelektiv/node-cron/compare/v2.3.1...v3.0.0-beta.1) (2023-07-23)
2
19
 
3
20
 
@@ -9,6 +26,41 @@
9
26
 
10
27
  * UNIX standard alignments ([#667](https://github.com/kelektiv/node-cron/issues/667)) ([96ef954](https://github.com/kelektiv/node-cron/commit/96ef954998f9c109cc2a969296568b1b56bbbd79))
11
28
 
29
+ ## [2.4.1](https://github.com/kelektiv/node-cron/compare/v2.4.0...v2.4.1) (2023-08-14)
30
+
31
+
32
+ ### 🐛 Bug Fixes
33
+
34
+ * 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))
35
+
36
+
37
+ ### ⚙️ Continuous Integrations
38
+
39
+ * **renovate:** configure renovate ([#683](https://github.com/kelektiv/node-cron/issues/683)) ([9dbe962](https://github.com/kelektiv/node-cron/commit/9dbe962fad1c8b1b020441bce84ab91b1a7b4415))
40
+
41
+ ## [2.4.0](https://github.com/kelektiv/node-cron/compare/v2.3.0...v2.4.0) (2023-07-24)
42
+
43
+
44
+ ### ✨ Features
45
+
46
+ * import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](https://github.com/kelektiv/node-cron/commit/d8a2f140b59f063897dd20b7bb4dc7f599d2435b))
47
+
48
+
49
+ ### 🐛 Bug Fixes
50
+
51
+ * don't start job in setTime if it wasn't running ([7e26c23](https://github.com/kelektiv/node-cron/commit/7e26c23e06277bfeb04525c71b67703392dbb8b2))
52
+
53
+
54
+ ### 🛠 Builds
55
+
56
+ * **npm:** ship type definitions with releases ([0b663a8](https://github.com/kelektiv/node-cron/commit/0b663a8584f87cbec63042a4c217f43f38869fc4))
57
+
58
+
59
+ ### 🚨 Tests
60
+
61
+ * add test case for [#598](https://github.com/kelektiv/node-cron/issues/598) fix ([4322ef2](https://github.com/kelektiv/node-cron/commit/4322ef29fa8af201aed5cdf8b829d411311fe025))
62
+ * don't stop/start job before using setTime ([f0d5d3f](https://github.com/kelektiv/node-cron/commit/f0d5d3f32eddb8fd77b84438fe471fd374b34566))
63
+
12
64
 
13
65
  ### ⚙️ Continuous Integrations
14
66
 
@@ -19,6 +71,7 @@
19
71
  ### ♻️ Chores
20
72
 
21
73
  * update default branch name ([#678](https://github.com/kelektiv/node-cron/issues/678)) ([7471e95](https://github.com/kelektiv/node-cron/commit/7471e95cb7433b4f29cfa68da0a652ec8cf630b6))
74
+ * wrap setTime tests in describe and move down ([31989e0](https://github.com/kelektiv/node-cron/commit/31989e06f939bf1e9dbc6c0b6fc62c0a7144b9eb))
22
75
 
23
76
  ## [v2.3.1](https://github.com/kelektiv/node-cron/compare/v2.3.0...v2.3.1) (2023-05-25)
24
77
 
package/lib/time.js CHANGED
@@ -260,19 +260,23 @@ function CronTime(luxon) {
260
260
  throw new Error('ERROR: You specified an invalid date.');
261
261
  }
262
262
 
263
- // it shouldn't take more than 5 seconds to find the next execution time
264
- // being very generous with this. Throw error if it takes too long to find the next time to protect from
265
- // infinite loop.
266
- const timeout = Date.now() + 5000;
263
+ /**
264
+ * maximum match interval is 8 years:
265
+ * crontab has '* * 29 2 *' and we are on 1 March 2096:
266
+ * next matching time will be 29 February 2104
267
+ * source: https://github.com/cronie-crond/cronie/blob/0d669551680f733a4bdd6bab082a0b3d6d7f089c/src/cronnext.c#L401-L403
268
+ */
269
+ const maxMatch = luxon.DateTime.now().plus({ years: 8 });
270
+
267
271
  // determine next date
268
272
  while (true) {
269
273
  const diff = date - start;
270
274
 
271
- // hard stop if the current date is after the expected execution
272
- if (Date.now() > timeout) {
275
+ // hard stop if the current date is after the maximum match interval
276
+ if (date > maxMatch) {
273
277
  throw new Error(
274
- `Something went wrong. It took over five seconds to find the next execution time for the cron job.
275
- 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:
278
+ `Something went wrong. No execution date was found in the next 8 years.
279
+ Please provide the following string if you would like to help debug:
276
280
  Time Zone: ${zone || '""'} - Cron String: ${this} - UTC offset: ${date.offset}
277
281
  - current Date: ${luxon.DateTime.local().toString()}`
278
282
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cron",
3
3
  "description": "Cron jobs for your node",
4
- "version": "3.0.0-beta.1",
4
+ "version": "3.0.0-beta.2",
5
5
  "author": "Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/kelektiv/node-cron/issues"