Skip to content

Commit 3acd71d

Browse files
author
Morten Henriksen
committed
fixes #9
Wait for pending futures to return before returning as finished
1 parent dadb918 commit 3acd71d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

graphql/execution/executors/asyncio.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ def __init__(self, loop=None):
3838

3939
def wait_until_finished(self):
4040
# if there are futures to wait for
41-
if self.futures:
41+
while self.futures:
4242
# wait for the futures to finish
43-
self.loop.run_until_complete(wait(self.futures))
43+
futures = self.futures
44+
self.futures = []
45+
self.loop.run_until_complete(wait(futures))
4446

4547
def execute(self, fn, *args, **kwargs):
4648
result = fn(*args, **kwargs)

0 commit comments

Comments
 (0)