fix: ensure socket cleanup in websocket handler

This commit is contained in:
retoor 2025-12-17 22:54:25 +01:00
parent bdc8f149dc
commit 70a405b231
3 changed files with 25 additions and 14 deletions

View File

@ -7,6 +7,14 @@
## Version 1.7.0 - 2025-12-17
Fixes socket cleanup in the websocket handler to prevent resource leaks and improve connection stability.
**Changes:** 1 files, 29 lines
**Languages:** Python (29 lines)
## Version 1.6.0 - 2025-12-17 ## Version 1.6.0 - 2025-12-17
Removes presence debounce to make user departures instant. Simplifies websocket connection and error handling in RPC views for improved reliability. Removes presence debounce to make user departures instant. Simplifies websocket connection and error handling in RPC views for improved reliability.

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "Snek" name = "Snek"
version = "1.6.0" version = "1.7.0"
readme = "README.md" readme = "README.md"
#license = { file = "LICENSE", content-type="text/markdown" } #license = { file = "LICENSE", content-type="text/markdown" }
description = "Snek Chat Application by Molodetz" description = "Snek Chat Application by Molodetz"

View File

@ -650,6 +650,7 @@ class RPCView(BaseView):
) )
rpc = RPCView.RPCApi(self, ws) rpc = RPCView.RPCApi(self, ws)
try:
async for msg in ws: async for msg in ws:
if msg.type == web.WSMsgType.TEXT: if msg.type == web.WSMsgType.TEXT:
try: try:
@ -663,4 +664,6 @@ class RPCView(BaseView):
pass pass
elif msg.type == web.WSMsgType.CLOSE: elif msg.type == web.WSMsgType.CLOSE:
pass pass
finally:
await self.services.socket.delete(ws)
return ws return ws