formatting
This commit is contained in:
parent
c3114d2ed2
commit
661d2cea3e
|
@ -12,6 +12,7 @@
|
|||
import sequtils, std/[tables]
|
||||
import chronos, chronicles, metrics, stew/[endians2, byteutils, objects]
|
||||
import ../muxer, ../../stream/connection
|
||||
import ../../utils/future
|
||||
|
||||
export muxer
|
||||
|
||||
|
@ -280,7 +281,7 @@ method readOnce*(
|
|||
if channel.recvQueue.len == 0:
|
||||
channel.receivedData.clear()
|
||||
try: # https://github.com/status-im/nim-chronos/issues/516
|
||||
discard await race(channel.closedRemotely.wait(), channel.receivedData.wait())
|
||||
discard await raceCancel(@[channel.closedRemotely.wait(), channel.receivedData.wait()])
|
||||
except ValueError:
|
||||
raiseAssert("Futures list is not empty")
|
||||
if channel.closedRemotely.isSet() and channel.recvQueue.len == 0:
|
||||
|
|
|
@ -13,7 +13,6 @@ import ../helpers
|
|||
import ../../libp2p/utils/future
|
||||
|
||||
suite "Utils Future":
|
||||
|
||||
asyncTest "All Pending Tasks are canceled when returned future is canceled":
|
||||
proc longRunningTaskA() {.async.} =
|
||||
await sleepAsync(10.seconds)
|
||||
|
@ -50,4 +49,4 @@ suite "Utils Future":
|
|||
asyncTest "raceCancel with AsyncEvent":
|
||||
let asyncEvent = newAsyncEvent()
|
||||
|
||||
await raceCancel(@[asyncEvent.wait()])
|
||||
await raceCancel(@[asyncEvent.wait()])
|
||||
|
|
Loading…
Reference in New Issue