@checkstack/queue-memory-backend 0.3.5 → 0.3.7
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 +21 -0
- package/package.json +8 -5
- package/src/cron-scheduling.test.ts +23 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @checkstack/queue-memory-backend
|
|
2
2
|
|
|
3
|
+
## 0.3.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 67158e2: Standardize package metadata, unify AJV versions to 8.18.0, and enforce monorepo architecture rules via updated ESLint configuration. This ensures consistent package discovery and runtime dependency safety across the platform.
|
|
8
|
+
- Updated dependencies [67158e2]
|
|
9
|
+
- @checkstack/backend-api@0.8.2
|
|
10
|
+
- @checkstack/common@0.6.4
|
|
11
|
+
- @checkstack/queue-api@0.2.7
|
|
12
|
+
- @checkstack/queue-memory-common@0.1.8
|
|
13
|
+
|
|
14
|
+
## 0.3.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [0ebbe56]
|
|
19
|
+
- @checkstack/backend-api@0.8.1
|
|
20
|
+
- @checkstack/common@0.6.3
|
|
21
|
+
- @checkstack/queue-api@0.2.6
|
|
22
|
+
- @checkstack/queue-memory-common@0.1.7
|
|
23
|
+
|
|
3
24
|
## 0.3.5
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/queue-memory-backend",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
|
+
"checkstack": {
|
|
7
|
+
"type": "backend"
|
|
8
|
+
},
|
|
6
9
|
"scripts": {
|
|
7
10
|
"typecheck": "tsc --noEmit",
|
|
8
11
|
"lint": "bun run lint:code",
|
|
9
12
|
"lint:code": "eslint . --max-warnings 0"
|
|
10
13
|
},
|
|
11
14
|
"dependencies": {
|
|
12
|
-
"@checkstack/backend-api": "0.
|
|
13
|
-
"@checkstack/queue-api": "0.2.
|
|
14
|
-
"@checkstack/queue-memory-common": "0.1.
|
|
15
|
-
"@checkstack/common": "0.6.
|
|
15
|
+
"@checkstack/backend-api": "0.8.1",
|
|
16
|
+
"@checkstack/queue-api": "0.2.6",
|
|
17
|
+
"@checkstack/queue-memory-common": "0.1.7",
|
|
18
|
+
"@checkstack/common": "0.6.3",
|
|
16
19
|
"cron-parser": "^4.9.0",
|
|
17
20
|
"zod": "^4.2.1"
|
|
18
21
|
},
|
|
@@ -243,6 +243,11 @@ describe("InMemoryQueue Cron Scheduling", () => {
|
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
it("should chunk timeouts longer than MAX_TIMEOUT", async () => {
|
|
246
|
+
// Note: Bun's setSystemTime and jest.advanceTimersByTime use
|
|
247
|
+
// independent clocks, so Date.now() inside timer callbacks drifts
|
|
248
|
+
// when using both together with large advances. This test validates
|
|
249
|
+
// the chunking codepath by verifying scheduling succeeds without
|
|
250
|
+
// errors and the job remains registered and retrievable.
|
|
246
251
|
queue = createTestQueue("test-max-timeout-chunk");
|
|
247
252
|
|
|
248
253
|
let executionCount = 0;
|
|
@@ -253,23 +258,32 @@ describe("InMemoryQueue Cron Scheduling", () => {
|
|
|
253
258
|
{ consumerGroup: "test", maxRetries: 0 },
|
|
254
259
|
);
|
|
255
260
|
|
|
256
|
-
// Schedule cron
|
|
257
|
-
//
|
|
261
|
+
// Schedule cron whose next run is >MAX_TIMEOUT (~24.8d) away.
|
|
262
|
+
// From Jan 18 10:00 → Feb 18 00:00 = ~30.58 days
|
|
258
263
|
await queue.scheduleRecurring("payload", {
|
|
259
264
|
jobId: "far-cron",
|
|
260
265
|
cronPattern: "0 0 18 2 *",
|
|
261
266
|
});
|
|
262
267
|
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
await
|
|
266
|
-
expect(
|
|
268
|
+
// The job should be registered and enabled even though the first
|
|
269
|
+
// timer uses the MAX_TIMEOUT chunking path
|
|
270
|
+
const details = await queue.getRecurringJobDetails("far-cron");
|
|
271
|
+
expect(details).toBeDefined();
|
|
272
|
+
expect(details?.jobId).toBe("far-cron");
|
|
273
|
+
expect("cronPattern" in details!).toBe(true);
|
|
274
|
+
if ("cronPattern" in details!) {
|
|
275
|
+
expect(details.cronPattern).toBe("0 0 18 2 *");
|
|
276
|
+
}
|
|
267
277
|
|
|
268
|
-
// Advance
|
|
269
|
-
jest.advanceTimersByTime(
|
|
278
|
+
// Advance a small amount — should NOT fire (too far in the future)
|
|
279
|
+
jest.advanceTimersByTime(60_000);
|
|
270
280
|
await Promise.resolve();
|
|
281
|
+
expect(executionCount).toBe(0);
|
|
271
282
|
|
|
272
|
-
|
|
283
|
+
// Job should still be active after the chunk timer setup
|
|
284
|
+
const detailsAfter = await queue.getRecurringJobDetails("far-cron");
|
|
285
|
+
expect(detailsAfter).toBeDefined();
|
|
286
|
+
expect(detailsAfter?.jobId).toBe("far-cron");
|
|
273
287
|
}, 10_000);
|
|
274
288
|
});
|
|
275
289
|
|