8000 gh-124309: Modernize the `staggered_race` implementation to support eager task factories by ZeroIntensity · Pull Request #124390 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-124309: Modernize the staggered_race implementation to support eager task factories #124390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove obsolete loop parameter.
  • Loading branch information
ZeroIntensity committed Sep 24, 2024
commit 57bb25a6324252998146ea4e0dd4075dcfbf6929
2 changes: 1 addition & 1 deletion Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ async def create_connection(
(functools.partial(self._connect_sock,
exceptions, addrinfo, laddr_infos)
for addrinfo in infos),
happy_eyeballs_delay, loop=self)
happy_eyeballs_delay)

if sock is None:
exceptions = [exc for sub in exceptions for exc in sub]
Expand Down
5 changes: 2 additions & 3 deletions Lib/asyncio/staggered.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
class _Done(Exception):
pass

async def staggered_race(coro_fns, delay, *, loop=None):

async def staggered_race(coro_fns, delay):
"""Run coroutines with staggered start times and take the first to finish.

This method takes an iterable of coroutine functions. The first one is
Expand Down Expand Up @@ -44,8 +45,6 @@ async def staggered_race(coro_fns, delay, *, loop=None):
delay: amount of time, in seconds, between starting coroutines. If
``None``, the coroutines will run sequentially.

loop: the event loop to use.

Returns:
tuple *(winner_result, winner_index, exceptions)* where

Expand Down
Loading
0