Skip to content

Commit fa666b9

Browse files
authored
run all ready tasks prior to calling poll in poll_loop.py (#84)
This ensures we make as much progress as possible and accumulate as many `pollable`s as possible prior to calling `poll`. Previously, we were accidentally limiting concurrency (and potentially getting stuck in cases where there were interdepdencencies between tasks) by only running one task per loop. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 58c9430 commit fa666b9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bundled/poll_loop.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ def run_until_complete(self, future):
125125
self.running = True
126126
asyncio.events._set_running_loop(self)
127127
while self.running and not future.done():
128-
handle = self.handles[0]
129-
self.handles = self.handles[1:]
130-
if not handle._cancelled:
131-
handle._run()
128+
handles = self.handles
129+
self.handles = []
130+
for handle in handles:
131+
if not handle._cancelled:
132+
handle._run()
132133

133134
if self.wakers:
134135
[pollables, wakers] = list(map(list, zip(*self.wakers)))

0 commit comments

Comments
 (0)