Arm the watchdog for every mode, not just snapshot

The watchdog was spawned inside snapshot.run, so legacy highlights mode ran
without it. That is the mode NickelMenu invokes, against the endpoint that
stopped responding and hung a run for 16 days — so the exact failure being
fixed was still reachable from the device's menu.

Moves the spawn into main, ahead of mode dispatch, so both paths are covered.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
wes
2026-08-01 18:22:23 -04:00
co-authored by Claude Opus 5
parent f55e9d0253
commit 32d7db1668
2 changed files with 13 additions and 5 deletions
+5 -1
View File
@@ -169,15 +169,19 @@ pub fn main() !void {
std.fmt.parseInt(u64, args[4], 10) catch snapshot.default_timeout_secs
else
snapshot.default_timeout_secs;
try snapshot.startWatchdog(timeout);
return snapshot.run(
allocator,
args[2],
if (args.len >= 4) args[3] else null,
snapshot.default_snapshot_path,
timeout,
);
}
// Legacy mode uploads too, so it needs the same protection: the endpoint it posts to
// is what hung a run for 16 days.
try snapshot.startWatchdog(snapshot.default_timeout_secs);
// `highlights <db> [endpoint]`, or the legacy `<db> [endpoint]` form.
const legacy = std.mem.eql(u8, args[1], "highlights");
const rest = if (legacy) args[2..] else args[1..];