mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
refactor(jobs): keep the lane's hold grace private to the lane
This commit is contained in:
1 parent
111047491e
commit
d1545cf554
2 files changed
+9
-5
No files matched your search
@@ -17,7 +17,7 @@ vi.mock("@/lib/observability/container-memory", () => ({
|
||||
import { emitSignal } from "@/lib/logging/signal";
|
||||
import {
|
||||
heavyLane,
|
||||
LANE_HOLD_GRACE_SECONDS,
|
||||
LANE_DEFER_SECONDS,
|
||||
LANE_WAIT_WARN_MS,
|
||||
laneWanted,
|
||||
} from "../heavy-lane";
|
||||
@@ -309,8 +309,9 @@ describe("a holder that never finishes", () => {
|
||||
now,
|
||||
)([{ ...job("restore"), expireInSeconds: 21600 } as TestJob]);
|
||||
|
||||
// Inside the backup's expiry and grace, the restore waits its turn.
|
||||
clock = start + (7200 + LANE_HOLD_GRACE_SECONDS) * 1000;
|
||||
// Inside the backup's expiry and the grace of one deferral after it, the
|
||||
// restore waits its turn.
|
||||
clock = start + (7200 + LANE_DEFER_SECONDS) * 1000;
|
||||
await tryRestore();
|
||||
expect(restore).not.toHaveBeenCalled();
|
||||
expect(back.map((b) => b.queue)).toEqual(["backup-restore"]);
|
||||
|
||||
@@ -113,8 +113,11 @@ export const LANE_YIELD_DELAY_SECONDS = 2 * LANE_DEFER_SECONDS;
|
||||
/** How long a job may stand in line before the wait is reported at `warn`. */
|
||||
export const LANE_WAIT_WARN_MS = 2 * 60 * 60 * 1000;
|
||||
|
||||
/** How long past its jobs' expiry a holder keeps the lane before it is taken. */
|
||||
export const LANE_HOLD_GRACE_SECONDS = LANE_DEFER_SECONDS;
|
||||
/**
|
||||
* How long past its jobs' expiry a holder keeps the lane before it is taken:
|
||||
* one deferral, so a job that went back just before the expiry finds it.
|
||||
*/
|
||||
const LANE_HOLD_GRACE_SECONDS = LANE_DEFER_SECONDS;
|
||||
|
||||
/** What one trip back to the queue did. */
|
||||
export interface LaneDeferral {
|
||||
|
||||
Reference in new issue
Block a user