pi-straw-boss 0.115.1 → 0.115.2

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.
@@ -3427,7 +3427,7 @@ async function restartLocked(ctx, { reason, downgrade, upgrade, boss, limit, cou
3427
3427
  return { server: upgrade ? "upgraded" : "restarted", record: await launch(ctx, { began, old, deadline }) };
3428
3428
  }
3429
3429
  async function supervised(ctx, hold, old, began, deadline) {
3430
- hold.release();
3430
+ void (hold.release(), ctx.log.line("restart-supervisor-wait", { by: ctx.by, pid: old.pid, ms: ctx.timers.supervisor }));
3431
3431
  const back = await waitReady(ctx, ctx.timers.supervisor, { old, began, deadline });
3432
3432
  if (back && "pid" in back) return back;
3433
3433
  try {
@@ -120,7 +120,7 @@ import {
120
120
  writeEnd,
121
121
  writeJson,
122
122
  writerAlive
123
- } from "./chunk-DCLYCHJ2.mjs";
123
+ } from "./chunk-X3FZH4LO.mjs";
124
124
 
125
125
  // src/server/cli.ts
126
126
  import { existsSync as existsSync3, realpathSync as realpathSync4 } from "node:fs";
@@ -308,7 +308,7 @@ import {
308
308
  writeStartError,
309
309
  writerAlive,
310
310
  yardPath
311
- } from "./chunk-DCLYCHJ2.mjs";
311
+ } from "./chunk-X3FZH4LO.mjs";
312
312
 
313
313
  // src/server/main.ts
314
314
  import { homedir as homedir18 } from "node:os";
@@ -27880,7 +27880,7 @@ function createRuns2(o) {
27880
27880
  if (svc.wake && svc.wakeAt <= due && svc.wakeAt >= held2) return;
27881
27881
  clearTimeout(svc.wake);
27882
27882
  svc.wakeAt = due;
27883
- svc.wake = setTimeout(() => (svc.wake = void 0, now() < heldUntil(svc) || svc.watched && due - at > t.wake && now() < due ? poke(svc) : (svc.watched = false, void begin(svc).catch((cause) => (error("run-begin", cause.message), svc.state = "standing")))), (svc.watched ||= held2 > at) && (held2 > at || due - at > t.wake) ? Math.min(due - at, t.watch) : due - at);
27883
+ svc.wake = setTimeout(() => (svc.wake = void 0, now() < heldUntil(svc) || due - at > t.wake && now() < due ? poke(svc) : (svc.watched = false, void begin(svc).catch((cause) => (error("run-begin", cause.message), svc.state = "standing")))), (svc.watched ||= held2 > at) && (held2 > at || due - at > t.wake) ? Math.min(due - at, t.watch) : due - at);
27884
27884
  svc.wake.unref();
27885
27885
  };
27886
27886
  const release = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-straw-boss",
3
- "version": "0.115.1",
3
+ "version": "0.115.2",
4
4
  "description": "Straw Boss coordination for pi in Herdr: sessions join a tab's net by choice, the first joiner is its main agent, a workspace tower opens on demand with a live monitoring dashboard, and boss_broadcast reaches the rest",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -672,7 +672,7 @@ async function restartLocked(ctx: Ctx, { reason, downgrade, upgrade, boss, limit
672
672
  * none came. Gives the server that came, or undefined with the lock held again.
673
673
  */
674
674
  async function supervised(ctx: Ctx, hold: Hold, old: Replaced, began: string | undefined, deadline?: number): Promise<ServerRecord | undefined> {
675
- hold.release();
675
+ void (hold.release(), ctx.log.line("restart-supervisor-wait", { by: ctx.by, pid: old.pid, ms: ctx.timers.supervisor }));
676
676
  const back = await waitReady(ctx, ctx.timers.supervisor, { old, began, deadline });
677
677
  if (back && "pid" in back) return back;
678
678
  try {
@@ -303,7 +303,7 @@ interface Svc {
303
303
  wake?: ReturnType<typeof setTimeout>;
304
304
  /** When `wake` fires. */
305
305
  wakeAt?: number;
306
- /** The wake was held by the boss's answering: a hold's end does not start a run before the wake's own time (a milestone's wait), and the timer keeps the watcher's pace till then. */
306
+ /** The wake was held by the boss's answering: the timer keeps the watcher's pace till the wake's own time (a milestone's wait), before which no run starts (`poke`). */
307
307
  watched?: boolean;
308
308
  timer?: ReturnType<typeof setTimeout>;
309
309
  crashes: number[];
@@ -472,7 +472,8 @@ export function createRuns(o: RunsOptions) {
472
472
  clearTimeout(svc.wake);
473
473
  svc.wakeAt = due;
474
474
  // A held wake is looked at again at the watcher's pace, and the hold is read off the clock then: no run begins while it stands, however late or early the timer fires, and none before the wake's own time (`due`) once it lapsed.
475
- svc.wake = setTimeout(() => ((svc.wake = undefined), now() < heldUntil(svc) || (svc.watched && due - at > t.wake && now() < due) ? poke(svc) : ((svc.watched = false), void begin(svc).catch((cause: Error) => (error("run-begin", cause.message), (svc.state = "standing"))))), ((svc.watched ||= held > at) && (held > at || due - at > t.wake)) ? Math.min(due - at, t.watch) : due - at);
475
+ // A wake longer than the short wait (a milestone's hold) is read off the clock too when its timer fires: one that fires early is set again, so the hold is the clock's (a test's own), not the timer's.
476
+ svc.wake = setTimeout(() => ((svc.wake = undefined), now() < heldUntil(svc) || (due - at > t.wake && now() < due) ? poke(svc) : ((svc.watched = false), void begin(svc).catch((cause: Error) => (error("run-begin", cause.message), (svc.state = "standing"))))), ((svc.watched ||= held > at) && (held > at || due - at > t.wake)) ? Math.min(due - at, t.watch) : due - at);
476
477
  svc.wake.unref();
477
478
  };
478
479
  const release = () => {