formatting

This commit is contained in:
Diego 2024-08-11 23:23:25 +02:00
parent c3114d2ed2
commit 661d2cea3e
No known key found for this signature in database
GPG Key ID: C9DAC9BF68D1F806
2 changed files with 3 additions and 3 deletions

View File

@ -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:

View File

@ -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()])