Skip to content

Commit

Permalink
websockets: avoid duplicate resolve call
Browse files Browse the repository at this point in the history
* Due to inheritance, we were calling
  `resolve(execution_result.data)` twice.
  • Loading branch information
oliver-sanders committed Jan 10, 2024
1 parent 6c6a2b4 commit 1311fbb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cylc/uiserver/websockets/tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from asyncio.queues import QueueEmpty
from tornado.websocket import WebSocketClosedError
from graphql.execution.middleware import MiddlewareManager
from graphql_ws.base import ConnectionClosedException
from graphql_ws.base import ConnectionClosedException, BaseSubscriptionServer
from graphql_ws.base_async import (
BaseAsyncConnectionContext,
BaseAsyncSubscriptionServer
Expand Down Expand Up @@ -165,4 +165,14 @@ async def send_execution_result(self, connection_context, op_id, execution_resul
await resolve(execution_result.data)
request_context = connection_context.request_context
await request_context['resolvers'].flow_delta_processed(request_context, op_id)
await super().send_execution_result(connection_context, op_id, execution_result)
else:
await resolve(execution_result.data)

# NOTE: skip TornadoSubscriptionServer.send_execution_result because it
# calls "resolve" then invokes BaseSubscriptionServer.send_execution_result
await BaseSubscriptionServer.send_execution_result(
self,
connection_context,
op_id,
execution_result,
)

0 comments on commit 1311fbb

Please sign in to comment.