Fix wsrelay connection leak (#15113)

- when re-establishing connection to db close old connection
- re-initialize WebSocketRelayManager when restarting asyncio.run
- log and ignore error in cleanup_offline_host (this might come back to bite us)
- cleanup connection when WebSocketRelayManager crash
This commit is contained in:
Hao Liu
2024-04-16 14:54:36 -04:00
committed by GitHub
parent 672f1eb745
commit e873bb1304
2 changed files with 76 additions and 53 deletions

View File

@@ -165,11 +165,10 @@ class Command(BaseCommand):
return
WebsocketsMetricsServer().start()
websocket_relay_manager = WebSocketRelayManager()
while True:
try:
asyncio.run(websocket_relay_manager.run())
asyncio.run(WebSocketRelayManager().run())
except KeyboardInterrupt:
logger.info('Shutting down Websocket Relayer')
break