Skip to content

Commit c601ce6

Browse files
denlinkTapac
authored andcommitted
Fix: TransactionManager.currentOrNull() is returning old transaction if connection.close() has failed (JetBrains#166)
1 parent ae8f22e commit c601ce6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/kotlin/org/jetbrains/exposed/sql/transactions/ThreadLocalTransactionManager.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ class ThreadLocalTransactionManager(private val db: Database,
3939
}
4040

4141
override fun close() {
42-
connection.close()
43-
threadLocal.set(outerTransaction)
42+
try {
43+
connection.close()
44+
} finally {
45+
threadLocal.set(outerTransaction)
46+
}
4447
}
4548

4649
}

0 commit comments

Comments
 (0)