mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +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:
parent
0e8462eaf1
commit
17d8065a34
@ -151,6 +151,7 @@ fun Routing.wsSongListRoutes() {
|
|||||||
}
|
}
|
||||||
} catch (e: ClosedReceiveChannelException) {
|
} catch (e: ClosedReceiveChannelException) {
|
||||||
logger.error("Error in WebSocket: ${e.message}")
|
logger.error("Error in WebSocket: ${e.message}")
|
||||||
|
} finally {
|
||||||
removeSession(uid)
|
removeSession(uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ fun Routing.wsSongRoutes() {
|
|||||||
}
|
}
|
||||||
} catch(e: ClosedReceiveChannelException) {
|
} catch(e: ClosedReceiveChannelException) {
|
||||||
logger.error("Error in WebSocket: ${e.message}")
|
logger.error("Error in WebSocket: ${e.message}")
|
||||||
|
} finally {
|
||||||
removeSession(uid, this)
|
removeSession(uid, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ fun Routing.wsTimerRoutes() {
|
|||||||
}
|
}
|
||||||
} catch(e: ClosedReceiveChannelException) {
|
} catch(e: ClosedReceiveChannelException) {
|
||||||
logger.error("Error in WebSocket: ${e.message}")
|
logger.error("Error in WebSocket: ${e.message}")
|
||||||
|
} finally {
|
||||||
removeSession(uid, this)
|
removeSession(uid, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user