fix: Fixes to command stream
Chart Release / chart (push) Successful in 11s
Server Deploy / deploy (push) Successful in 2m36s

This commit is contained in:
2026-08-10 14:07:17 +01:00
parent 727bb09eff
commit ef86ef04a1
4 changed files with 119 additions and 22 deletions
+11
View File
@@ -382,6 +382,17 @@ func (s *vantageServer) CommandStream(stream pb.Vantage_CommandStreamServer) err
if beats == 1 {
log.Printf("agent %s command stream beating every %s", srv.ServerID, pingInterval)
}
// A beat the stream accepted is the strongest liveness evidence this
// pod has, so it is also used to renew presence. The renewal ticker
// proves only that a goroutine still runs; this proves the stream
// itself still carries bytes to the agent. A false answer means
// another pod has taken the agent over and this stream is a
// half-open leftover, which is worth ending here rather than beating
// into for as long as the connection survives.
if !services.TouchPresence(ctx, srv.ServerID) {
log.Printf("agent %s command stream superseded, closing", srv.ServerID)
return nil
}
case cmd, ok := <-ch:
if !ok {
return nil