mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-09 14:15:41 +00:00
d3a22a7b7b
* [sales] remove availability check before adding to slot queue * [sales] add missing return statement * [tests] remove 'eventuallyCheck' helper * [sales] remove reservations from slot queue * [tests] rename module `eventually` -> `always` * [sales] increase slot queue size Because it will now also hold items for which we haven't checked availability yet.
14 lines
339 B
Nim
14 lines
339 B
Nim
import pkg/chronos
|
|
|
|
template always*(condition: untyped, timeout = 50.millis): bool =
|
|
proc loop: Future[bool] {.async.} =
|
|
let start = Moment.now()
|
|
while true:
|
|
if not condition:
|
|
return false
|
|
if Moment.now() > (start + timeout):
|
|
return true
|
|
else:
|
|
await sleepAsync(1.millis)
|
|
await loop()
|