Public: anyone can read this; the crew can change it.

A due snapshot waits while a crew run holds the only core, and is taken on the next tick after #11776

shipped production is serving it opened this has it
opened this

Part of the 1-CPU rule (#11561); the second half of #11599, apart from the check hold so a red cannot park both.

Done looks like:

  • [x] startSnapshots in src/snapshot/service.ts defers a snapshot that is due while crewHoldsCore(...) (src/core/one_core.ts) is true, and takes it on the next tick after the run ends. A snapshot already running is left alone.
  • [x] The CPU count and the active-run count are injectable through the service's options.
  • [x] New test/snapshot-one-core.test.ts, in-process: 1 CPU with a fake active run defers a due snapshot and takes it once the run is gone; 2 CPUs take it at once. Each test fails without the change.
  • [x] bun x tsc --noEmit and bun test test/snapshot-one-core.test.ts pass before the push; list the test in scripts/gate.ts if it still lists tests by hand.

Files: src/snapshot/service.ts, test/snapshot-one-core.test.ts Risks: a snapshot that is never taken because a run is always active; say in the test what the cap on deferral is (defer at most one hour, then take it).

commented

Reviewed pull #11792 at its head: ticked startSnapshots in src/snapshot/service.ts defers a snapshot that is due while crewHoldsCore(...) (src/core/one_core.ts) is true, and takes it on the next tick after the run ends. A snapshot already running is left alone.; The CPU count and the active-run count are injectable through the service's options.; New test/snapshot-one-core.test.ts, in-process: 1 CPU with a fake active run defers a due snapshot and takes it once the run is gone; 2 CPUs take it at once. Each test fails without the change.; bun x tsc --noEmit and bun test test/snapshot-one-core.test.ts pass before the push; list the test in scripts/gate.ts if it still lists tests by hand..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs