* fix #14685 tests/async/t7758.nim flaky * address comment * address comment
This commit is contained in:
parent
9c42ae91b7
commit
5ad8b9e8eb
1 changed files with 7 additions and 2 deletions
|
|
@ -2,7 +2,8 @@ import asyncdispatch
|
||||||
import std/unittest
|
import std/unittest
|
||||||
|
|
||||||
proc task() {.async.} =
|
proc task() {.async.} =
|
||||||
await sleepAsync(40)
|
const tSleep = 40
|
||||||
|
await sleepAsync(tSleep)
|
||||||
|
|
||||||
proc main() =
|
proc main() =
|
||||||
var counter = 0
|
var counter = 0
|
||||||
|
|
@ -11,6 +12,10 @@ proc main() =
|
||||||
inc(counter)
|
inc(counter)
|
||||||
poll(10)
|
poll(10)
|
||||||
|
|
||||||
check 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.
|
||||||
|
check counter <= 4 + slack
|
||||||
|
|
||||||
for i in 0 .. 10: main()
|
for i in 0 .. 10: main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue