From 7a2bb89c9bbf29add869b73a6541ffd51e280bb2 Mon Sep 17 00:00:00 2001 From: Alliballibaba Date: Thu, 18 Sep 2025 22:09:18 +0200 Subject: [PATCH] Waits briefly to ensure logs are flushed --- threadtaskworker_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/threadtaskworker_test.go b/threadtaskworker_test.go index f10ad2b7..73507cd4 100644 --- a/threadtaskworker_test.go +++ b/threadtaskworker_test.go @@ -5,6 +5,7 @@ import ( "log/slog" "net/http/httptest" "testing" + "time" "github.com/stretchr/testify/assert" ) @@ -61,7 +62,8 @@ func TestDispatchToTaskWorkerFromWorker(t *testing.T) { assertGetRequest(t, "http://example.com/testdata/tasks/task-dispatcher.php?count=4", "dispatched 4 tasks") - // shutdown to ensure all logs are flushed + // wait and shutdown to ensure all logs are flushed + time.Sleep(10 * time.Millisecond) Shutdown() // task output appears in logs at info level