huskies: merge 1147 story One-active-gateway invariant via pidfile+flock — prevent double-gateway during restarts
This commit is contained in:
@@ -163,7 +163,10 @@ pub async fn execute_trampoline_core(job: &TrampolineJob) -> Result<(), String>
|
||||
}
|
||||
let _ = std::fs::copy(&job.old_binary_path, &job.backup_binary_path);
|
||||
|
||||
// Kill old gateway.
|
||||
// Kill old gateway. Killing the process closes its file descriptors,
|
||||
// which releases the exclusive flock held on `$HOME/.huskies/gateway.pid`.
|
||||
// The new gateway (spawned below) will then acquire that flock on startup,
|
||||
// ensuring the one-active-gateway invariant is maintained across the swap.
|
||||
kill_gateway_process(job.gateway_pid)?;
|
||||
|
||||
// Start new gateway.
|
||||
|
||||
Reference in New Issue
Block a user