@spfn/core 0.2.0-beta.55 → 0.2.0-beta.57

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.
@@ -21,6 +21,13 @@ interface JobOptions {
21
21
  * @default 1000
22
22
  */
23
23
  retryDelay?: number;
24
+ /**
25
+ * Exponential backoff between retries (retryDelay * 2^attempt). Defaults to
26
+ * true so a failed cohort (e.g. on a provider 429) doesn't all retry at the
27
+ * same fixed offset — a thundering herd. Set false for fixed retryDelay.
28
+ * @default true
29
+ */
30
+ retryBackoff?: boolean;
24
31
  /**
25
32
  * Job expiration in seconds
26
33
  * @default 300 (5 minutes)
package/dist/db/index.js CHANGED
@@ -1457,6 +1457,24 @@ async function runInTransaction(callback, options = {}) {
1457
1457
  "Timeout exceeds maximum",
1458
1458
  { txId, context, timeout, maxTimeout: MAX_TIMEOUT_MS }
1459
1459
  );
1460
+ validateAndThrow(
1461
+ !Number.isInteger(idleTimeout),
1462
+ `Invalid idleTimeout value: ${idleTimeout}. Must be an integer.`,
1463
+ "Invalid idleTimeout type",
1464
+ { txId, context, idleTimeout }
1465
+ );
1466
+ validateAndThrow(
1467
+ idleTimeout < 0,
1468
+ `Invalid idleTimeout value: ${idleTimeout}. Must be non-negative (0 to disable).`,
1469
+ "Invalid idleTimeout range",
1470
+ { txId, context, idleTimeout }
1471
+ );
1472
+ validateAndThrow(
1473
+ idleTimeout > MAX_TIMEOUT_MS,
1474
+ `Invalid idleTimeout value: ${idleTimeout}. Maximum is ${MAX_TIMEOUT_MS}ms.`,
1475
+ "idleTimeout exceeds maximum",
1476
+ { txId, context, idleTimeout, maxTimeout: MAX_TIMEOUT_MS }
1477
+ );
1460
1478
  const writeDb = getDatabase("write");
1461
1479
  if (!writeDb) {
1462
1480
  const error = new TransactionError({