Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a755bbb
Implement Happy Eyeballs in asyncio.
twisteroidambassador May 24, 2018
fc29450
Use module import instead of individual imports.
twisteroidambassador May 29, 2018
d792c43
Change TODO.
twisteroidambassador May 29, 2018
f9111d0
Rename helpers.py to staggered.py.
twisteroidambassador May 29, 2018
ded34e0
Add create_connection()'s new arguments in documentation.
twisteroidambassador May 29, 2018
b069c95
Add blurb.
twisteroidambassador May 29, 2018
c5d3a92
Implement Happy Eyeballs in asyncio.
twisteroidambassador May 24, 2018
38c7caa
Use module import instead of individual imports.
twisteroidambassador May 29, 2018
70ec96d
Change TODO.
twisteroidambassador May 29, 2018
cef0a76
Rename helpers.py to staggered.py.
twisteroidambassador May 29, 2018
73a4a5a
Add create_connection()'s new arguments in documentation.
twisteroidambassador May 29, 2018
b3a6e1c
Add blurb.
twisteroidambassador May 29, 2018
632166d
Merge remote-tracking branch 'origin/happy-eyeballs' into happy-eyeballs
twisteroidambassador May 30, 2018
b8d7e41
Remove _roundrobin as a standalone function.
twisteroidambassador Jun 3, 2018
ecdc83a
Rename delay to happy_eyeballs_delay and decouple from interleave.
twisteroidambassador Jun 3, 2018
5fa5a9b
Update docs.
twisteroidambassador Jun 5, 2018
321e4ac
Update comments.
twisteroidambassador Jun 5, 2018
b4227ed
Import staggered_race into main asyncio package.
twisteroidambassador Jun 5, 2018
cffacc7
Change `delay` to `happy_eyeballs_delay` in AbstractEventLoop.
twisteroidambassador Jun 26, 2018
3e304dd
Change `delay` to `happy_eyeballs_delay` in documentation and blurb.
twisteroidambassador Jun 26, 2018
a8c39b9
Add suggested value for `happy_eyeballs_delay` in documentation.
twisteroidambassador Jun 26, 2018
f6f2219
Tune RST markup
asvetlov Aug 1, 2018
f0e37e6
Keep .staggered as private API
asvetlov May 5, 2019
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
Use module import instead of individual imports.
  • Loading branch information
twisteroidambassador committed May 30, 2018
commit 38c7caa05cf65c59b1d4a23df4b18cda7686ca6c
21 changes: 11 additions & 10 deletions Lib/asyncio/helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from contextlib import suppress
from typing import Iterable, Callable, Any, Tuple, List, Optional, Awaitable
import contextlib
import typing

from . import events
from . import futures
Expand All @@ -8,14 +8,14 @@


async def staggered_race(
coro_fns: Iterable[Callable[[], Awaitable]],
delay: Optional[float],
coro_fns: typing.Iterable[typing.Callable[[], typing.Awaitable]],
delay: typing.Optional[float],
*,
loop: events.AbstractEventLoop = None,
) -> Tuple[
Any,
Optional[int],
List[Optional[Exception]]
) -> typing.Tuple[
typing.Any,
typing.Optional[int],
typing.List[typing.Optional[Exception]]
]:
"""Run coroutines with staggered start times and take the first to finish.

Expand Down Expand Up @@ -75,10 +75,11 @@ async def staggered_race(
exceptions = []
running_tasks = []

async def run_one_coro(previous_failed: Optional[locks.Event]) -> None:
async def run_one_coro(
previous_failed: typing.Optional[locks.Event]) -> None:
# Wait for the previous task to finish, or for delay seconds
if previous_failed is not None:
with suppress(futures.TimeoutError):
with contextlib.suppress(futures.TimeoutError):
# Use asyncio.wait_for() instead of asyncio.wait() here, so
# that if we get cancelled at this point, Event.wait() is also
# cancelled, otherwise there will be a "Task destroyed but it is
Expand Down