mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 03:14:08 +00:00
Merge pull request #8840 from pigmej/fix_with_timeout
Handle fut.failed in asyncdispatch.WithTimeout
This commit is contained in:
@@ -1536,7 +1536,11 @@ proc withTimeout*[T](fut: Future[T], timeout: int): Future[bool] =
|
||||
var timeoutFuture = sleepAsync(timeout)
|
||||
fut.callback =
|
||||
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 =
|
||||
proc () =
|
||||
if not retFuture.finished: retFuture.complete(false)
|
||||
|
||||
Reference in New Issue
Block a user