Skip to content

Commit 5abd858

Browse files
committed
asyncio.wait receiving coroutines is deprecated, create tasks explicitly
1 parent 56f46a1 commit 5abd858

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

graphql_ws/base_async.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ async def resolve(
5454
else:
5555
items = None
5656
if items is not None:
57-
children = [resolve(child, _container=data, _key=key) for key, child in items]
57+
children = [
58+
asyncio.create_task(resolve(child, _container=data, _key=key))
59+
for key, child in items
60+
]
5861
if children:
5962
await asyncio.wait(children)
6063

@@ -90,10 +93,7 @@ def remember_task(self, task):
9093

9194
async def unsubscribe(self, op_id):
9295
async_iterator = super().unsubscribe(op_id)
93-
if (
94-
getattr(async_iterator, "future", None)
95-
and async_iterator.future.cancel()
96-
):
96+
if getattr(async_iterator, "future", None) and async_iterator.future.cancel():
9797
await async_iterator.future
9898

9999
async def unsubscribe_all(self):

0 commit comments

Comments
 (0)