Lightweight server monitoring with historical data, docker stats, and alerts.
fix(agent): extend WebSocket deadline for slow collections (#2297)
Ryan Chou027d0c204d91
diff --git a/agent/client.go b/agent/client.goindex 0dc80fa66..9b1351f69 100644--- a/agent/client.go+++ b/agent/client.go@@ -25,7 +25,9 @@ import ()const (- wsDeadline = 70 * time.Second+ // Keep the connection alive long enough for a slow collection cycle to+ // finish before the hub considers the agent disconnected.+ wsDeadline = 120 * time.Second)type caCertFileError struct {diff --git a/agent/client_test.go b/agent/client_test.goindex a4598fc11..97cb66545 100644--- a/agent/client_test.go+++ b/agent/client_test.go@@ -700,3 +700,11 @@ func TestGetToken(t *testing.T) {assert.Equal(t, expectedToken, token, "Whitespace should be stripped from token file content")})}++func TestWebSocketDeadlineCoversSlowCollection(t *testing.T) {+ const minimumDeadline = 120 * time.Second++ if wsDeadline < minimumDeadline {+ t.Fatalf("WebSocket deadline %s is shorter than the slow-collection window of %s", wsDeadline, minimumDeadline)+ }+}