MCPcopy Create free account
hub / github.com/dbunt1tled/python-fast-api / close_all

Method close_all

src/core/web_socket/ws_manager.py:88–101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

86 return False
87
88 async def close_all(self) -> None:
89 async with self._lock:
90 conns = [(uid, s) for uid, s in self._connections.items()]
91 self._connections.clear()
92 coros = []
93 for uid, socks in conns:
94 for ws in socks:
95 try:
96 coros.append(ws[0].close())
97 except Exception as e:
98 self.log.warning(f"🫜 WebSocket failed to close to {uid}: {e}")
99 if coros:
100 await asyncio.gather(*coros, return_exceptions=True)
101 self.log.info("🥝 WebSocket Closed all websockets")

Callers 1

lifespanFunction · 0.80

Calls 3

warningMethod · 0.80
infoMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected