Skip to content

Commit b350590

Browse files
authored
Update asgi.py
1 parent 139ba98 commit b350590

File tree

1 file changed

+5
-5
lines changed
  • src/py/reactpy/reactpy/backend

1 file changed

+5
-5
lines changed

src/py/reactpy/reactpy/backend/asgi.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(
7878
self._cached_index_html = ""
7979
self.connected = False
8080
self.backhaul_thread = backhaul_thread
81-
self.dispatcher_future_or_task = None
81+
self.dispatcher = None
8282
if self.backhaul_thread and not _backhaul_thread.is_alive():
8383
_backhaul_thread.start()
8484

@@ -136,15 +136,15 @@ async def component_dispatch_app(self, scope, receive, send) -> None:
136136
await send({"type": "websocket.accept"})
137137
run_dispatcher = self.run_dispatcher(scope, receive, send)
138138
if self.backhaul_thread:
139-
self.dispatcher_future_or_task = asyncio.run_coroutine_threadsafe(
139+
self.dispatcher = asyncio.run_coroutine_threadsafe(
140140
run_dispatcher, _backhaul_loop
141141
)
142142
else:
143-
self.dispatcher_future_or_task = asyncio.create_task(run_dispatcher)
143+
self.dispatcher = asyncio.create_task(run_dispatcher)
144144

145145
if event["type"] == "websocket.disconnect":
146-
if self.dispatcher_future_or_task:
147-
self.dispatcher_future_or_task.cancel()
146+
if self.dispatcher:
147+
self.dispatcher.cancel()
148148
break
149149

150150
if event["type"] == "websocket.receive":

0 commit comments

Comments
 (0)