From fb47e1abbbd0c6f4cfc065d7d7dc8de3f2da82d7 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 28 May 2023 19:59:54 +0200 Subject: [PATCH] TestContextWatcherStress: reduce sleep counts --- pgconn/internal/ctxwatch/context_watcher_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pgconn/internal/ctxwatch/context_watcher_test.go b/pgconn/internal/ctxwatch/context_watcher_test.go index 583199c7..d62b97d3 100644 --- a/pgconn/internal/ctxwatch/context_watcher_test.go +++ b/pgconn/internal/ctxwatch/context_watcher_test.go @@ -104,7 +104,9 @@ func TestContextWatcherStress(t *testing.T) { } // Without time.Sleep, cw.Unwatch will almost always run before the cancel func which means cancel will never happen. This gives us a better mix. - if i%3 == 0 { + if i%333 == 0 { + // on Windows Sleep takes more time than expected so we try to get here less frequently to avoid + // the CI takes a long time time.Sleep(time.Nanosecond) }