From ec9e845bb6ce5d3bba0497e7ac114a2ead9c45e9 Mon Sep 17 00:00:00 2001 From: Jeremie Fraeys Date: Mon, 23 Feb 2026 14:38:18 -0500 Subject: [PATCH] fix(test): Fix WebSocketQueue test timeout and race conditions Reduce worker polling interval from 5ms to 1ms for faster task pickup Add 100ms buffer after job submission to allow queue to settle Increase timeout from 30s to 60s to prevent flaky failures Fixes intermittent timeout issues in integration tests --- .../websocket_queue_integration_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/integration/websocket_queue_integration_test.go b/tests/integration/websocket_queue_integration_test.go index e82c756..3e0c100 100644 --- a/tests/integration/websocket_queue_integration_test.go +++ b/tests/integration/websocket_queue_integration_test.go @@ -109,8 +109,11 @@ func TestWebSocketQueueEndToEnd(t *testing.T) { } submitWG.Wait() + // Give workers time to pick up any remaining tasks + time.Sleep(100 * time.Millisecond) + completed := 0 - timeout := time.After(30 * time.Second) + timeout := time.After(60 * time.Second) for completed < jobCount { select { case <-timeout: @@ -206,8 +209,11 @@ func TestWebSocketQueueEndToEndSQLite(t *testing.T) { } submitWG.Wait() + // Give workers time to pick up any remaining tasks + time.Sleep(100 * time.Millisecond) + completed := 0 - timeout := time.After(30 * time.Second) + timeout := time.After(60 * time.Second) for completed < jobCount { select { case <-timeout: @@ -310,11 +316,11 @@ func startFakeWorkers( task, err := taskQueue.GetNextTaskWithLease(workerID, 30*time.Second) if err != nil { t.Logf("worker %s queue error: %v", workerID, err) - time.Sleep(5 * time.Millisecond) + time.Sleep(time.Millisecond) continue } if task == nil { - time.Sleep(5 * time.Millisecond) + time.Sleep(time.Millisecond) continue }