fix: keep load test websocket sessions alive

This commit is contained in:
richjohnrambo
2026-09-27 21:41:50 +08:00
parent bde02e8eac
commit ea8732e2b1
7 changed files with 111 additions and 1 deletions
+13
View File
@@ -141,6 +141,9 @@ func runAgent(ctx context.Context, cfg *Config, manifest *Manifest, machine, coo
if err != nil {
return err
}
if alive := run.aliveConnections(); alive != len(run.clients) {
return fmt.Errorf("connections alive after coordinator wait=%d expected=%d", alive, len(run.clients))
}
if !runIDPattern.MatchString(start.RunID) || !validScenario(start.Scenario) {
return fmt.Errorf("invalid coordinator start: %+v", start)
}
@@ -586,6 +589,16 @@ func (r *agentRun) acceptedCopy() []AcceptedMessage {
return out
}
func (r *agentRun) aliveConnections() int {
alive := 0
for _, client := range r.clients {
if client.alive() {
alive++
}
}
return alive
}
func (r *agentRun) drainDuration() (time.Duration, error) {
if r.scenario == "p2p" {
return configDuration(r.cfg.DrainP2P)