@genroc/eval-node 0.22.0 → 0.23.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/dist/worker.js CHANGED
@@ -166,9 +166,9 @@ async function answer(token, outcome) {
166
166
  await release(token);
167
167
  }
168
168
  async function run(job, signal) {
169
- // The task's own timeout is the script's budget. Taken on arrival, because fetching the
170
- // objects below spends the same deadline.
171
- const due = job.deadline_in_ms === undefined ? undefined : performance.now() + job.deadline_in_ms;
169
+ // The task's own timeout is the script's budget, moved onto the monotonic clock so a wall-clock
170
+ // step mid-run cannot stretch it. Fetching the objects below spends the same deadline.
171
+ const due = job.deadline === undefined ? undefined : performance.now() + (Date.parse(job.deadline) - Date.now());
172
172
  let resolved;
173
173
  try {
174
174
  resolved = await resolveObjects(job);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genroc/eval-node",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"
package/worker.ts CHANGED
@@ -42,7 +42,7 @@ type QueueTask = {
42
42
  task: string;
43
43
  external_input: unknown;
44
44
  objects?: ObjectEntry[];
45
- deadline_in_ms?: number;
45
+ deadline?: string;
46
46
  };
47
47
 
48
48
  // Large values arrive as refs; a bundle is one object per definition version, fetched once.
@@ -188,9 +188,9 @@ async function answer(token: string, outcome: Record<string, unknown>): Promise<
188
188
  }
189
189
 
190
190
  async function run(job: QueueTask, signal: AbortSignal): Promise<void> {
191
- // The task's own timeout is the script's budget. Taken on arrival, because fetching the
192
- // objects below spends the same deadline.
193
- const due = job.deadline_in_ms === undefined ? undefined : performance.now() + job.deadline_in_ms;
191
+ // The task's own timeout is the script's budget, moved onto the monotonic clock so a wall-clock
192
+ // step mid-run cannot stretch it. Fetching the objects below spends the same deadline.
193
+ const due = job.deadline === undefined ? undefined : performance.now() + (Date.parse(job.deadline) - Date.now());
194
194
  let resolved: unknown;
195
195
  try {
196
196
  resolved = await resolveObjects(job);