File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 2
2
3
3
__all__ = 'staggered_race' ,
4
4
5
- import contextlib
6
5
import typing
7
6
8
7
from . import events
9
- from . import exceptions as exceptions_mod
10
8
from . import locks
11
9
from . import tasks
12
10
@@ -83,12 +81,11 @@ async def run_one_coro(
83
81
previous_failed : typing .Optional [locks .Event ]) -> None :
84
82
# Wait for the previous task to finish, or for delay seconds
85
83
if previous_failed is not None :
86
- with contextlib .suppress (exceptions_mod .TimeoutError ):
87
- # Use asyncio.wait_for() instead of asyncio.wait() here, so
88
- # that if we get cancelled at this point, Event.wait() is also
89
- # cancelled, otherwise there will be a "Task destroyed but it is
90
- # pending" later.
91
- await tasks .wait_for (previous_failed .wait (), delay )
84
+ wait_task = tasks .create_task (previous_failed .wait ())
85
+ try :
86
+ await tasks .
53FF
wait ((wait_task ,), timeout = delay )
87
+ finally :
88
+ wait_task .cancel ()
92
89
# Get the next coroutine to run
93
90
try :
94
91
this_index , coro_fn = next (enum_coro_fns )
You can’t perform that action at this time.
0 commit comments