Notify replaced plugin processes at upgrade grace start
Send rpc.superseded with the newly active hash before activation returns. Add an opt-in SDK hook and drain helper that closes SDK listeners and idle connections without cancelling active handlers or background work. Document the additive notice and preserve existing grace, stop and restart rules. Cover immediate notices, ignored notices, early service restarts, SDK draining and duplicate-hook diagnostics. Card: SAU-352
This commit is contained in:
@@ -89,7 +89,24 @@ fn main() {
|
||||
if request["method"] == "serve" {
|
||||
std::fs::write(format!("/state/{plugin}/service"), version).unwrap();
|
||||
}
|
||||
for _ in lines {}
|
||||
for line in lines {
|
||||
let Ok(message) = serde_json::from_str::<Value>(&line.unwrap()) else {
|
||||
continue;
|
||||
};
|
||||
if message["method"] == "rpc.superseded" {
|
||||
std::fs::write(
|
||||
format!(
|
||||
"/state/{plugin}/superseded-{}",
|
||||
std::env::var("SAUSAGE_PID").unwrap()
|
||||
),
|
||||
message.to_string(),
|
||||
)
|
||||
.unwrap();
|
||||
if request["params"]["exit_on_superseded"] == true {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::fs::write(format!("/state/{plugin}/ended-{version}"), "ended").unwrap();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user