Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Sep 30, 2024
1 parent 604eb5e commit 964cf86
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/aiohappyeyeballs/_staggered.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,20 @@ async def run_one_coro(
break

while tasks:
if start_next:
done = await _wait_one([*tasks, start_next], loop)
if done is start_next:
# The current task has failed or the timer has expired
# so we need to start the next task.
start_next = None
if start_next_timer:
start_next_timer.cancel()
start_next_timer = None

# Break out of the task waiting loop to start the next
# task.
break
else:
done = await _wait_one(tasks, loop)
done = await _wait_one(
[*tasks, start_next] if start_next else tasks, loop
)
if done is start_next:
# The current task has failed or the timer has expired
# so we need to start the next task.
start_next = None
if start_next_timer:
start_next_timer.cancel()
start_next_timer = None

# Break out of the task waiting loop to start the next
# task.
break

if TYPE_CHECKING:
assert isinstance(done, asyncio.Task)
Expand Down

0 comments on commit 964cf86

Please sign in to comment.