parent
d06da9ccf0
commit
ac066c5db0
1 changed files with 5 additions and 1 deletions
|
|
@ -1536,7 +1536,11 @@ proc withTimeout*[T](fut: Future[T], timeout: int): Future[bool] =
|
||||||
var timeoutFuture = sleepAsync(timeout)
|
var timeoutFuture = sleepAsync(timeout)
|
||||||
fut.callback =
|
fut.callback =
|
||||||
proc () =
|
proc () =
|
||||||
if not retFuture.finished: retFuture.complete(true)
|
if not retFuture.finished:
|
||||||
|
if fut.failed:
|
||||||
|
retFuture.fail(fut.error)
|
||||||
|
else:
|
||||||
|
retFuture.complete(true)
|
||||||
timeoutFuture.callback =
|
timeoutFuture.callback =
|
||||||
proc () =
|
proc () =
|
||||||
if not retFuture.finished: retFuture.complete(false)
|
if not retFuture.finished: retFuture.complete(false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue