Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Notable changes to Swarmail. Versions follow [semantic versioning](https://semve

## Unreleased

- `swarmail wake-auto-t3` logs `received SIGTERM; stopping` (or `SIGINT`) when it receives the signal, so a
signalled stop no longer looks like a silent exit 0 in the journal.

- The provider comparison covers T3 Code 0.1.1 and the reviewed nightly's terminal commands,
pull-request lookup limits and automatic-notice snooze behavior.

Expand Down
15 changes: 10 additions & 5 deletions src/wake-auto-t3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,14 @@ export async function wakeAutoT3(args: string[]): Promise<number> {
return 64;
}
const abort = new AbortController();
const stop = () => abort.abort();
process.once("SIGTERM", stop);
process.once("SIGINT", stop);
const stopOn = (signalName: string) => () => {
console.error(`swarmail wake-auto-t3: received ${signalName}; stopping`);
abort.abort();
};
const onTerm = stopOn("SIGTERM");
const onInt = stopOn("SIGINT");
process.once("SIGTERM", onTerm);
process.once("SIGINT", onInt);
let lock: ReturnType<typeof openWakeState> | undefined;
let failures = new Map<string, string>();
let failuresLoaded = false;
Expand Down Expand Up @@ -686,7 +691,7 @@ export async function wakeAutoT3(args: string[]): Promise<number> {
lock.close();
}
}
process.removeListener("SIGTERM", stop);
process.removeListener("SIGINT", stop);
process.removeListener("SIGTERM", onTerm);
process.removeListener("SIGINT", onInt);
}
}
4 changes: 3 additions & 1 deletion test/wake-auto-t3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,9 @@ test("automatic supervisor waits out a T3 restart and follows its new port", asy
await stalled?.stop(true);
f.close();
}
expect(await errors).toContain("T3 backend unavailable; waiting for verified readiness");
const log = await errors;
expect(log).toContain("T3 backend unavailable; waiting for verified readiness");
expect(log.match(/swarmail wake-auto-t3: received SIGTERM; stopping/g)).toHaveLength(1);
}, 30000);

test("automatic scans repeat only after a T3 commit, a registry write, a reopen or the rescan interval", () => {
Expand Down
Loading