From a26586c6b4829deafd1e2d56b5faf83e12b49a7b Mon Sep 17 00:00:00 2001 From: dalbodeule <11470513+dalbodeule@users.noreply.github.com> Date: Sat, 10 Aug 2024 17:29:40 +0900 Subject: [PATCH] debug session (2x) - MariadbSessionStorage not found error fix. --- .../chzzk_bot/webserver/MariadbSessionStorage.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/MariadbSessionStorage.kt b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/MariadbSessionStorage.kt index e9b40fc..7da7b45 100644 --- a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/MariadbSessionStorage.kt +++ b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/MariadbSessionStorage.kt @@ -25,15 +25,17 @@ class MariadbSessionStorage: SessionStorage { } override suspend fun write(id: String, value: String) { - val session = Session.find(SessionTable.key eq id).firstOrNull() + return transaction { + val session = Session.find(SessionTable.key eq id).firstOrNull() - if(session == null) { - Session.new { - this.key = id - this.value = value + if (session == null) { + Session.new { + this.key = id + this.value = value + } + } else { + session.value = value } - } else { - session.value = value } } } \ No newline at end of file