Skip to content

Commit e634208

Browse files
committed
Ensure subscriptions are erased on close.
1 parent ff897ba commit e634208

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

api/server.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ async def websocket_connector(self, websocket: WebSocket) -> None:
118118

119119
# Remove the websocket and it's subscriptions...
120120
del self.sockets[uid]
121-
for sub in subscriptions:
121+
122+
subscribed: list[str] = [sub for sub in self.subscription_sockets if uid in self.subscription_sockets[sub]]
123+
for sub in subscribed:
122124
self.subscription_sockets[sub].remove(uid)
123125

124126
def websocket_subscribe(self, *, uid: int, message: dict[str, Any]) -> dict[str, Any]:

0 commit comments

Comments
 (0)