Review and fix some usages of Future.cancel; Bump Chronos

This commit is contained in:
Zahary Karadjov 2020-11-17 20:03:29 +02:00
parent 9c5cef346b
commit ebfacf597c
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
3 changed files with 3 additions and 6 deletions

View File

@ -404,7 +404,7 @@ proc init*(T: type Eth1Monitor,
let web3Fut = newWeb3(web3Url)
yield web3Fut or sleepAsync(chronos.seconds(5))
if (not web3Fut.finished) or web3Fut.failed:
web3Fut.cancel()
await cancelAndWait(web3Fut)
return err "Failed to setup web3 connection"
let

View File

@ -789,13 +789,10 @@ proc dialPeer*(node: Eth2Node, peerAddr: PeerAddr, index = 0) {.async.} =
deadline.cancel()
inc nbc_successful_dials
else:
# TODO(cheatfate): As soon as `nim-libp2p` will be able to handle cancellation
# properly and will have cancellation tests, we need add here cancellation
# of `workfut`.
# workfut.cancel()
debug "Connection to remote peer timed out"
inc nbc_timeout_dials
node.addSeen(peerAddr.peerId, SeenTableTimeTimeout)
await cancelAndWait(workfut)
except CatchableError as exc:
debug "Connection to remote peer failed", msg = exc.msg
inc nbc_failed_dials

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 710454cc6b792748144882d7c97912b0c6cef138
Subproject commit 879c917242ab2af0a8332669f92987cd1e40370f