File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
jupyter_rtc_core/websockets Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -181,8 +181,21 @@ def stop(self):
181181 Closes all Websocket connections with close code 1001 (server
182182 shutting down) and ignores any future calls to `add()`.
183183 """
184+ # Remove all clients from both dictionaries
185+ client_ids = set (self .desynced .keys ()) | set (self .synced .keys ())
186+ clients : list [YjsClient ] = []
187+ for client_id in client_ids :
188+ client = self .desynced .pop (client_id , None )
189+ if not client :
190+ client = self .synced .pop (client_id , None )
191+ if client :
192+ clients .append (client )
193+
194+ assert len (self .desynced ) == 0
195+ assert len (self .synced ) == 0
196+
184197 # Close all Websocket connections
185- for client in self . get_all ( synced_only = False ) :
198+ for client in clients :
186199 client .websocket .close (code = 1001 )
187200
188201 # Set `_stopped` to `True` to ignore future calls to `add()`
You can’t perform that action at this time.
0 commit comments