mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 21:01:14 +00:00
Fix session cleanup in WebSocket routes
Add missing `finally` blocks to ensure session removal in WebSocket routes after exceptions. This prevents potential memory leaks and ensures proper resource cleanup.
This commit is contained in:
@@ -151,6 +151,7 @@ fun Routing.wsSongListRoutes() {
|
||||
}
|
||||
} catch (e: ClosedReceiveChannelException) {
|
||||
logger.error("Error in WebSocket: ${e.message}")
|
||||
} finally {
|
||||
removeSession(uid)
|
||||
}
|
||||
}
|
||||
|
@@ -110,6 +110,7 @@ fun Routing.wsSongRoutes() {
|
||||
}
|
||||
} catch(e: ClosedReceiveChannelException) {
|
||||
logger.error("Error in WebSocket: ${e.message}")
|
||||
} finally {
|
||||
removeSession(uid, this)
|
||||
}
|
||||
}
|
||||
|
@@ -87,6 +87,7 @@ fun Routing.wsTimerRoutes() {
|
||||
}
|
||||
} catch(e: ClosedReceiveChannelException) {
|
||||
logger.error("Error in WebSocket: ${e.message}")
|
||||
} finally {
|
||||
removeSession(uid, this)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user