File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 11bearssl;https://github.com/status-im/nim-bearssl@#667b40440a53a58e9f922e29e20818720c62d9ac
22chronicles;https://github.com/status-im/nim-chronicles@#32ac8679680ea699f7dbc046e8e0131cac97d41a
3- chronos;https://github.com/status-im/nim-chronos@#dc3847e4d6733dfc3811454c2a9c384b87343e26
3+ chronos;https://github.com/status-im/nim-chronos@#ef93a15bf9eb22b3fcc15aab3edaf3f8ae9618a7
44dnsclient;https://github.com/ba0f3/dnsclient.nim@#23214235d4784d24aceed99bbfe153379ea557c8
55faststreams;https://github.com/status-im/nim-faststreams@#720fc5e5c8e428d9d0af618e1e27c44b42350309
66httputils;https://github.com/status-im/nim-http-utils@#3b491a40c60aad9e8d3407443f46f62511e63b18
Original file line number Diff line number Diff line change @@ -33,9 +33,17 @@ proc anyCompleted*[T](futs: seq[Future[T]]): Future[Future[T]] {.async.} =
3333 let index = requests.find (raceFut)
3434 requests.del (index)
3535
36- proc raceCancel * (
37- futs: seq [Future | InternalRaisesFuture ]
36+ proc raceAndCancelPending * (
37+ futs: seq [SomeFuture ]
3838): Future [void ] {.async : (raises: [ValueError , CancelledError ]).} =
39+ # # Executes a race between the provided sequence of futures.
40+ # # Cancels any remaining futures that have not yet completed.
41+ # #
42+ # # - `futs`: A sequence of futures to race.
43+ # #
44+ # # Raises:
45+ # # - `ValueError` if the sequence of futures is empty.
46+ # # - `CancelledError` if the operation is canceled.
3947 try :
4048 discard await race (futs)
4149 finally :
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ suite "Utils Future":
2525 futureB = longRunningTaskB ()
2626
2727 # Both futures should be canceled when raceCancel is called
28- await raceCancel (@ [futureA, futureB]).cancelAndWait ()
28+ await raceAndCancelPending (@ [futureA, futureB]).cancelAndWait ()
2929 check futureA.cancelled
3030 check futureB.cancelled
3131
@@ -42,16 +42,16 @@ suite "Utils Future":
4242 futureSlow = slowTask ()
4343
4444 # The quick task finishes, so the slow task should be canceled
45- await raceCancel (@ [futureQuick, futureSlow])
45+ await raceAndCancelPending (@ [futureQuick, futureSlow])
4646 check futureQuick.finished
4747 check futureSlow.cancelled
4848
49- asyncTest " raceCancel with AsyncEvent" :
49+ asyncTest " raceAndCancelPending with AsyncEvent" :
5050 let asyncEvent = newAsyncEvent ()
5151 let fut1 = asyncEvent.wait ()
5252 let fut2 = newAsyncEvent ().wait ()
5353 asyncEvent.fire ()
54- await raceCancel (@ [fut1, fut2])
54+ await raceAndCancelPending (@ [fut1, fut2])
5555
5656 check fut1.finished
5757 check fut2.cancelled
You can’t perform that action at this time.
0 commit comments