Skip to content

Commit 94d8740

Browse files
committed
Iterators are considered awaitable with the new method, so check only not aiter
1 parent a1d2ebc commit 94d8740

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

graphql_ws/base_async.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ async def on_start(self, connection_context, op_id, params):
143143
execution_result = self.execute(params)
144144

145145
connection_context.register_operation(op_id, execution_result)
146-
if is_awaitable(execution_result):
147-
execution_result = await execution_result
148-
149146
if hasattr(execution_result, "__aiter__"):
150147
iterator = await execution_result.__aiter__()
151148
connection_context.register_operation(op_id, iterator)
@@ -160,6 +157,8 @@ async def on_start(self, connection_context, op_id, params):
160157
await self.send_error(connection_context, op_id, e)
161158
else:
162159
try:
160+
if is_awaitable(execution_result):
161+
execution_result = await execution_result
163162
await self.send_execution_result(
164163
connection_context, op_id, execution_result
165164
)

0 commit comments

Comments
 (0)