LiveRelay.stop() fired the claim releases and forgot them, and nothing closed the shared backend's Postgres pool: on a redeploy the process could exit first, leaving the other instances to follow a dead relay until the claim went stale (30 s). stop() is now async and resolves once the releases are written; MediaService.stop() passes it through; the container awaits it and closes the backend on SIGTERM, and `media serve` gained SIGINT/SIGTERM handling that does the same and closes open sockets so publishers and viewers reconnect elsewhere. Verified: a test that a stopped relay's claim is gone at once; a real `media serve --s3 --pg --advertise` with a live publisher: SIGTERM → exit in ~0.4 s, its shade_live_publishers row 1 → 0, the publisher reconnecting. Suites green (media 101, storage-postgres 20, server 55, cli 15). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
12 KiB
12 KiB