Skip to content

Commit d95ed49

Browse files
committed
fix(model-server-lib): remove session data after session ends
1 parent bb32f1a commit d95ed49

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

model-server-lib/src/main/kotlin/org/modelix/model/server/light/LightModelServer.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,15 @@ class LightModelServer(val port: Int, val rootNode: INode, val ignoredRoles: Set
116116
}
117117
routing {
118118
webSocket("/ws") {
119+
var session: SessionData? = null
119120
try {
120-
val session = SessionData(this)
121+
session = SessionData(this)
121122
sessions.add(session)
122123
handleWebsocket(session)
123124
} catch (ex: Exception) {
124125
LOG.error(ex) { "Error in websocket handler" }
126+
} finally {
127+
sessions.remove(session)
125128
}
126129
}
127130
}

0 commit comments

Comments
 (0)