Add scale limit constants, stale-agent indexed query, and tests.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Extract fleet caps (128 hosts, sem=16, 250ms coalesce, syscheck=20) into named constants with Go tests; wire ListStaleOnlineAgents for stale sweeps instead of full ListAgents scans.
This commit is contained in:
10
server/internal/api/scale_limits.go
Normal file
10
server/internal/api/scale_limits.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package api
|
||||
|
||||
import "time"
|
||||
|
||||
// WebSocket fleet telemetry scale limits.
|
||||
const (
|
||||
StatsBatchCoalesceInterval = 250 * time.Millisecond
|
||||
StaleAgentSweepInterval = 45 * time.Second
|
||||
StaleAgentThreshold = 3 * time.Minute
|
||||
)
|
||||
18
server/internal/api/scale_limits_test.go
Normal file
18
server/internal/api/scale_limits_test.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestScaleLimitConstants(t *testing.T) {
|
||||
if StatsBatchCoalesceInterval != 250*time.Millisecond {
|
||||
t.Fatalf("StatsBatchCoalesceInterval = %v, want 250ms", StatsBatchCoalesceInterval)
|
||||
}
|
||||
if StaleAgentSweepInterval != 45*time.Second {
|
||||
t.Fatalf("StaleAgentSweepInterval = %v, want 45s", StaleAgentSweepInterval)
|
||||
}
|
||||
if StaleAgentThreshold != 3*time.Minute {
|
||||
t.Fatalf("StaleAgentThreshold = %v, want 3m", StaleAgentThreshold)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user