From 61b45bb9212152f5452f6e159bafdbb489e6f81e Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Mon, 24 Mar 2025 13:44:13 +1100 Subject: [PATCH] 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 --- tests/helpers.nim | 16 ++++++---------- vendor/asynctest | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/helpers.nim b/tests/helpers.nim index 429a30a7..cff99e60 100644 --- a/tests/helpers.nim +++ b/tests/helpers.nim @@ -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) diff --git a/vendor/asynctest b/vendor/asynctest index 73c08f77..32df0f19 160000 --- a/vendor/asynctest +++ b/vendor/asynctest @@ -1 +1 @@ -Subproject commit 73c08f77afc5cc2a5628d00f915b97bf72f70c9b +Subproject commit 32df0f19d6e0e6f84c762cf8de7361ddb419f4ba