mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 12:51:13 +00:00
Handle WebSocket session removal on channel closure
Add `removeSession` calls in WebSocket exception handling blocks to ensure proper session cleanup when a `ClosedReceiveChannelException` occurs. Prevents potential resource leaks and ensures consistency across WebSocket routes.
This commit is contained in:
@@ -151,6 +151,7 @@ fun Routing.wsSongListRoutes() {
|
||||
}
|
||||
} catch (e: ClosedReceiveChannelException) {
|
||||
logger.error("Error in WebSocket: ${e.message}")
|
||||
removeSession(uid)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -110,6 +110,7 @@ fun Routing.wsSongRoutes() {
|
||||
}
|
||||
} catch(e: ClosedReceiveChannelException) {
|
||||
logger.error("Error in WebSocket: ${e.message}")
|
||||
removeSession(uid, this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -87,6 +87,7 @@ fun Routing.wsTimerRoutes() {
|
||||
}
|
||||
} catch(e: ClosedReceiveChannelException) {
|
||||
logger.error("Error in WebSocket: ${e.message}")
|
||||
removeSession(uid, this)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user