Hot-reload content on a NATS trigger instead of requiring a restart
Deploy / deploy (push) Successful in 29s
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:
@@ -22,6 +22,7 @@ tower = { version = "0.5", optional = true }
|
||||
tower-http = { version = "0.6", features = ["fs"], optional = true }
|
||||
tower-sessions = { version = "0.14", optional = true }
|
||||
async-nats = { version = "0.38", optional = true }
|
||||
arc-swap = { version = "1", optional = true }
|
||||
url = { version = "2", optional = true }
|
||||
serde_yaml = { version = "0.9", optional = true }
|
||||
sha2 = { version = "0.10", optional = true }
|
||||
@@ -76,6 +77,7 @@ ssr = [
|
||||
"dep:tower-http",
|
||||
"dep:tower-sessions",
|
||||
"dep:async-nats",
|
||||
"dep:arc-swap",
|
||||
"dep:url",
|
||||
"dep:serde_yaml",
|
||||
"dep:sha2",
|
||||
|
||||
Reference in New Issue
Block a user