From e05daba73e36589403d29d7f720e3abd2e1921b6 Mon Sep 17 00:00:00 2001 From: narimiran Date: Wed, 25 Aug 2021 08:22:51 +0200 Subject: [PATCH] try to fix the flaky test, similarly to the devel version --- tests/async/t7758.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/async/t7758.nim b/tests/async/t7758.nim index 15aec1c042..29d7941395 100644 --- a/tests/async/t7758.nim +++ b/tests/async/t7758.nim @@ -1,7 +1,8 @@ import asyncdispatch proc task() {.async.} = - await sleepAsync(40) + const tSleep = 40 + await sleepAsync(tSleep) proc main() = var counter = 0 @@ -10,6 +11,10 @@ proc main() = inc(counter) poll(10) - doAssert counter <= 4 + const slack = 1 + # because there is overhead in `async` + `sleepAsync` + # as can be seen by increasing `tSleep` from 40 to 49, which increases the number + # of failures. + doAssert counter <= 4 + slack for i in 0 .. 4: main()