@terreno/jobs 57.18.0 → 57.20.0

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://github.com/TerrenoLabs/terreno/issues"
5
5
  },
6
6
  "dependencies": {
7
- "@terreno/api": "57.18.0",
7
+ "@terreno/api": "57.20.0",
8
8
  "cron": "^4.3.4",
9
9
  "express": "^5.2.1",
10
10
  "luxon": "^3.7.2"
@@ -12,7 +12,7 @@
12
12
  "description": "Durable background jobs plugin for @terreno/api — part of Terreno, the batteries-included TypeScript framework for universal apps.",
13
13
  "devDependencies": {
14
14
  "@biomejs/biome": "^2.3.6",
15
- "@terreno/test": "57.18.0",
15
+ "@terreno/test": "57.20.0",
16
16
  "@types/bun": "^1.4.0",
17
17
  "@types/express": "^5.0.6",
18
18
  "@types/luxon": "^3.7.1",
@@ -78,5 +78,5 @@
78
78
  "test:coverage": "bun run ../scripts/check-coverage.ts"
79
79
  },
80
80
  "types": "dist/index.d.ts",
81
- "version": "57.18.0"
81
+ "version": "57.20.0"
82
82
  }
@@ -167,6 +167,10 @@ describe("jobs recurring schedules", () => {
167
167
 
168
168
  await jobsApp.startWorker();
169
169
  const schedule = await JobSchedule.findExactlyOne({name: "overlap-skip"});
170
+ // Stop polling before the schedule is due so a 25ms tick cannot enqueue
171
+ // between the due write and the in-flight child.
172
+ await jobsApp.stopWorker();
173
+
170
174
  const staleNextRunAt = DateTime.utc().minus({minutes: 1}).toJSDate();
171
175
  await JobSchedule.updateOne({_id: schedule._id}, {$set: {nextRunAt: staleNextRunAt}});
172
176
 
@@ -176,11 +180,13 @@ describe("jobs recurring schedules", () => {
176
180
  scheduleId: schedule._id.toString(),
177
181
  });
178
182
 
179
- await waitUntil(async () => {
180
- const updated = await JobSchedule.findExactlyOne({_id: schedule._id});
181
- return updated.nextRunAt.getTime() > staleNextRunAt.getTime();
183
+ await tickDueSchedules({
184
+ jobsService: getJobsService(),
185
+ now: DateTime.utc().toJSDate(),
182
186
  });
183
- await jobsApp.stopWorker();
187
+
188
+ const updated = await JobSchedule.findExactlyOne({_id: schedule._id});
189
+ assert.isAbove(updated.nextRunAt.getTime(), staleNextRunAt.getTime());
184
190
 
185
191
  const childJobs = await Job.find({name: "overlap-skip"});
186
192
  assert.equal(childJobs.length, 1, "overlap tick must not enqueue a second child");