Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.

Reload services after server CRUD so creds aren't stale - #24

Merged
mondominator merged 1 commit into
mainfrom
fix/reload-services-on-server-update
May 5, 2026
Merged

mondominator merged 1 commit into
mainfrom
fix/reload-services-on-server-update

Conversation

@mondominator

Copy link
Copy Markdown
Owner

Summary

  • Call `restartMonitoring()` after each `POST /servers`, `PUT /servers/:id`, and `DELETE /servers/:id`
  • Tears down WebSockets and reinitializes services from the updated DB rows

Why

The mutation handlers updated the database but left the running media-server services holding their original URL/api_key in memory. Symptom: rotating Sappho's API key in the OpsDec UI looked successful, but the WebSocket and HTTP polls kept presenting the old (revoked) key until the container was restarted manually — Sappho's red dot stayed red.

`restartMonitoring()` already exists for this purpose (used by `POST /api/monitoring/restart`); the CRUD handlers just weren't calling it.

Test plan

  • `npm run lint` — no new warnings/errors
  • `npm test` — 134 backend tests pass
  • After deploy: rotate a server's API key in Settings; confirm OpsDec immediately uses the new key without a container restart

The /servers POST/PUT/DELETE handlers updated the database but left the
running media-server services holding their original URL/api_key in
memory, so e.g. rotating Sappho's API key in the UI looked successful
but the WebSocket and HTTP polls kept presenting the old (revoked) key
until the container was restarted manually. Call restartMonitoring()
after each mutation to tear down WebSockets and reinit services from
the updated DB rows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mondominator
mondominator merged commit 35119c4 into main May 5, 2026
1 check passed
@mondominator
mondominator deleted the fix/reload-services-on-server-update branch May 5, 2026 14:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant