@empyria/restate 0.4.9 → 0.4.11

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/lib/Cron.js CHANGED
@@ -11,12 +11,17 @@ export const setJobStateName = (jobStateName) => {
11
11
  }
12
12
 
13
13
  /**
14
- * A retry policy that never gives up: it backs off to one attempt a minute and keeps trying. Restate's default
15
- * stops after a few attempts and *pauses* the invocation, and a paused invocation of a virtual object holds the
16
- * object's lock, so every later call queues behind it for ever. A schedule that was due while the services were
17
- * down (a restart, a crash, a night off) must simply run when they are back, so jobs use this.
14
+ * A retry policy that practically never gives up: it backs off to one attempt a minute and keeps trying. Left to
15
+ * itself Restate stops after 70 attempts (about an hour at this pace) and *pauses* the invocation, and a paused
16
+ * invocation of a virtual object holds the object's lock, so every later call queues behind it for ever. A schedule
17
+ * that was due while the services were down (a restart, a crash, a night off) must simply run when they are back, so
18
+ * jobs use this.
19
+ *
20
+ * The attempt limit is the largest the server accepts. Leaving `maxAttempts` out, or setting it to `Infinity`, does
21
+ * not mean unlimited: the server then applies its own default of 70.
18
22
  */
19
23
  export const RETRY_FOREVER = {
24
+ maxAttempts: 2_147_483_647,
20
25
  initialInterval: { seconds: 1 },
21
26
  maxInterval: { minutes: 1 },
22
27
  exponentiationFactor: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empyria/restate",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "Restate.dev helpers for the Empyria nanoservice framework",
5
5
  "license": "MIT",
6
6
  "author": "Imre Fazekas <imre.fazekas@icloud.com>",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@empyria/classification": "0.1.9",
30
- "@empyria/common": "0.3.9",
30
+ "@empyria/common": "0.3.10",
31
31
  "@restatedev/pubsub": "0.3.2",
32
32
  "@restatedev/pubsub-client": "0.3.2",
33
33
  "@restatedev/restate-sdk": "1.17.2",
package/test/Cron.test.js CHANGED
@@ -293,9 +293,10 @@ describe('ensureCronJob', () => {
293
293
  })
294
294
 
295
295
  describe('retry policy', () => {
296
- test('a job never gives up: no attempt limit, so it is never paused', async () => {
296
+ test('a job practically never gives up, so it is never paused', async () => {
297
297
  const { RETRY_FOREVER } = await import('../lib/Cron.js')
298
- expect(RETRY_FOREVER.maxAttempts).toBeUndefined()
298
+ // Omitting the limit (or Infinity) would leave the server default of 70 attempts.
299
+ expect(RETRY_FOREVER.maxAttempts).toBe(2_147_483_647)
299
300
  expect(cronJob.options?.retryPolicy ?? cronJob.retryPolicy).toBeDefined()
300
301
  })
301
302
  })