Files
splatoon3.ink/app/data/RunLimits.test.mjs
Matt Isenhower 1aee4053c6 Give the slow lane a time budget and continue unfinished work
Durable Object alarms are stopped after 15 minutes, and a full X-Rank or
Splatfest rankings update can take longer than that:

- RunLimits takes an optional deadline. X-Rank season details, Splatfest
  rankings, and the slow lane's updater loop stop starting new work once
  it passes and mark the run incomplete; what is left updates in a later
  run. The current X-Rank season goes first.
- The slow lane runs with a 10-minute budget. An incomplete run is
  followed a minute later by a continuation (up to 10, never past the
  lane's next regular slot), which does not count as a retry. Manual runs
  continue the same way through a queued follow-up.
- Ignore Wrangler's local secrets files (.dev.vars*).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 12:59:36 -08:00

30 lines
753 B
JavaScript

import { afterEach, describe, expect, it, vi } from 'vitest';
import RunLimits from './RunLimits.mjs';
describe('RunLimits', () => {
afterEach(() => {
vi.useRealTimers();
});
it('never runs out of time without a deadline', () => {
let limits = new RunLimits;
expect(limits.outOfTime()).toBe(false);
expect(limits.incomplete).toBe(false);
});
it('marks the run incomplete once the deadline passes', () => {
vi.useFakeTimers();
vi.setSystemTime(1000);
let limits = new RunLimits({ deadline: 2000 });
expect(limits.outOfTime()).toBe(false);
expect(limits.incomplete).toBe(false);
vi.setSystemTime(2000);
expect(limits.outOfTime()).toBe(true);
expect(limits.incomplete).toBe(true);
});
});