Skip to content

Commit daaa235

Browse files
committed
prepare recv queue for potential threading
1 parent 750a821 commit daaa235

File tree

1 file changed

+3
-4
lines changed
  • src/py/reactpy/reactpy/backend

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ async def __call__(self, scope, receive, send) -> None:
118118
async def component_dispatch_app(self, scope, receive, send) -> None:
119119
"""The ASGI application for ReactPy Python components."""
120120

121-
self._reactpy_recv_queue: asyncio.Queue = asyncio.Queue()
122121
parsed_url = urllib.parse.urlparse(scope["path"])
123122

124123
# If in standalone mode, serve the user provided component.
@@ -130,7 +129,7 @@ async def component_dispatch_app(self, scope, receive, send) -> None:
130129

131130
if event["type"] == "websocket.connect":
132131
await send({"type": "websocket.accept"})
133-
132+
self.recv_queue: asyncio.Queue = asyncio.Queue()
134133
await serve_layout(
135134
Layout(
136135
ConnectionContext(
@@ -150,14 +149,14 @@ async def component_dispatch_app(self, scope, receive, send) -> None:
150149
)
151150
),
152151
send_json(send),
153-
self._reactpy_recv_queue.get,
152+
self.recv_queue.get,
154153
)
155154

156155
if event["type"] == "websocket.disconnect":
157156
break
158157

159158
if event["type"] == "websocket.receive":
160-
await self._reactpy_recv_queue.put(orjson.loads(event["text"]))
159+
await self.recv_queue.put(orjson.loads(event["text"]))
161160

162161
async def js_modules_app(self, scope, receive, send) -> None:
163162
"""The ASGI application for ReactPy web modules."""

0 commit comments

Comments
 (0)