Use five-second upgrade grace for every plugin
Ignore legacy grace metadata in both activation paths. Keep superseded delivery, admission ordering, discovery exclusion and the separate EOF stop budget. Document the uniform policy and cover both windows and opt-in drain. Card: SAU-357
This commit is contained in:
+3
-1
@@ -356,7 +356,9 @@
|
||||
//!
|
||||
//! The interface check covers calls, not state. Old and new processes share files in `/state`.
|
||||
//! `core.revert` restores code, not state. Preserve compatibility or migrate the state.
|
||||
//! `#[rpc(grace_seconds = N)]` declares the grace period for old processes. The default is 60 seconds.
|
||||
//! Core gives every old process 5 seconds of upgrade grace, then closes stdin and allows
|
||||
//! a separate 5-second stop budget before killing it. Discovery-only processes are excluded.
|
||||
//! `#[rpc(grace_seconds = N)]` still emits legacy `x-sausage-grace` metadata, but core ignores it.
|
||||
//! New calls use the new version immediately. Old processes can still use old imports during their grace period.
|
||||
//! [`macro@on_superseded`] handles the notice at grace start, with normal calls still available.
|
||||
//! It is opt-in: without a hook the process continues as before until core stops it.
|
||||
|
||||
@@ -60,6 +60,11 @@ impl Probe {
|
||||
sausage_plugin::listen("/state/control", std::rc::Rc::new(Control)).await?;
|
||||
Ok(sausage_plugin::pid())
|
||||
}
|
||||
/// Keep an idle listener and ownership lock until opt-in drain ends this process.
|
||||
async fn drain_service(&self) -> Result<String> {
|
||||
lock("/drain-owner").await?.keep();
|
||||
self.service().await
|
||||
}
|
||||
/// Add two numbers.
|
||||
///
|
||||
/// The result is their sum.
|
||||
@@ -170,6 +175,7 @@ impl Probe {
|
||||
#[sausage_plugin::on_stop]
|
||||
async fn stop(&self) {
|
||||
std::fs::write("/stopped", b"yes").unwrap();
|
||||
std::fs::write(format!("/stopped-{}", sausage_plugin::pid()), b"yes").unwrap();
|
||||
Ctx::default().notify("stopped", json!({})).unwrap();
|
||||
assert!(call("other.no", json!({})).await.is_err());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user