Remove new implementation of eventuallySafe by overidding the default params of eventually

With this fix in, there is no need to use the asynctest update that sets longer defaults for eventually, so downgrade asynctest
This commit is contained in:
Eric 2025-03-24 13:44:13 +11:00
parent 0fca36344f
commit 61b45bb921
No known key found for this signature in database
2 changed files with 7 additions and 11 deletions

View File

@ -4,6 +4,8 @@ import helpers/templeveldb
import std/times
import std/sequtils, chronos
import ./asynctest
export multisetup, trackers, templeveldb
### taken from libp2p errorhelpers.nim
@ -36,13 +38,7 @@ proc allFuturesThrowing*[T, E]( # https://github.com/nim-lang/Nim/issues/23432
): Future[void] =
allFuturesThrowing(futs.mapIt(FutureBase(it)))
template eventuallySafe*(expression: untyped, timeout=5000, pollInterval=1000)): bool =
proc eventuallySafe(): Future[bool] {.async.} =
let endTime = getTime() + initDuration(milliseconds = timeout)
while not expression:
if endTime < getTime():
return false
await sleepAsync(pollInterval)
return true
await eventuallySafe()
template eventuallySafe*(
expression: untyped, timeout = 5000, pollInterval = 1000
): bool =
eventually(expression, timeout, pollInterval)

2
vendor/asynctest vendored

@ -1 +1 @@
Subproject commit 73c08f77afc5cc2a5628d00f915b97bf72f70c9b
Subproject commit 32df0f19d6e0e6f84c762cf8de7361ddb419f4ba