Band Watch history in Postgres; fall back to Band Watch when idle #5

Merged
jhgaylor merged 1 commit from watch-postgres into main 2026-11-01 04:39:36 +00:00
Owner
  • store.py: Postgres (segments, watch_sessions, station_names) when DATABASE_URL is set, via a queued background writer; one-time import of watch.jsonl; JSONL fallback otherwise.
  • RADIOMAN_IDLE_MODE / RADIOMAN_IDLE_AFTER: start a mode when the radio is idle and at boot; restart it if it dies, with backoff.
  • SIGTERM shuts down cleanly, saving open segments.

Tested against postgres:17 (schema, inserts, import, connect retry) and the app with a fake radio (boot -> watch, stop -> back after the idle wait, SIGTERM closes the session and children).

🤖 Generated with Claude Code

- store.py: Postgres (segments, watch_sessions, station_names) when DATABASE_URL is set, via a queued background writer; one-time import of watch.jsonl; JSONL fallback otherwise. - RADIOMAN_IDLE_MODE / RADIOMAN_IDLE_AFTER: start a mode when the radio is idle and at boot; restart it if it dies, with backoff. - SIGTERM shuts down cleanly, saving open segments. Tested against postgres:17 (schema, inserts, import, connect retry) and the app with a fake radio (boot -> watch, stop -> back after the idle wait, SIGTERM closes the session and children). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
store.py: with DATABASE_URL, segments (with the station's PI/call sign/PS/format),
watch_sessions (swatch, start, heartbeat, end: the coverage) and station_names go to
Postgres through one background writer that queues and retries, so the radio never waits
on the database. watch.jsonl is imported once. Without a database, the JSONL file as before.

RADIOMAN_IDLE_MODE=watch starts Band Watch when the radio has been idle for
RADIOMAN_IDLE_AFTER seconds (and at boot), and restarts it if it dies, backing off while
it keeps failing. SIGTERM now shuts down like Ctrl-C, so open segments are saved when the
pod is replaced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/radioman!5
No description provided.