Hot-reload content on a NATS trigger instead of requiring a restart
Deploy / deploy (push) Successful in 29s

questions is now Arc<ArcSwap<HashMap<...>>> - readers do a lock-free
atomic load (state.questions.load().get(&id).cloned()), never blocking
on or blocked by a reload. content::watch_for_reload subscribes to
portal.content.reload (published by the questions repo's own CI after
it lints a push - see that repo's lint-and-reload.yml) and swaps in a
freshly re-fetched HashMap on each message. A fetch/parse failure logs
and keeps serving the last-good content rather than clearing it.
This commit is contained in:
Bendik Aagaard Lynghaug
2026-08-05 07:20:40 +02:00
parent b0086b2ed9
commit 18025bf870
8 changed files with 74 additions and 8 deletions
+2
View File
@@ -96,7 +96,9 @@ pub async fn transition_answer(
let state = expect_context::<AppState>();
let question = state
.questions
.load()
.get(&question_id)
.cloned()
.ok_or_else(|| ServerFnError::new("unknown question"))?;
let feature = question
.alternatives