summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2023-03-31 14:44:35 +0200
committerMS <ms@taler.net>2023-03-31 14:44:35 +0200
commitc3de34f3dae63fd969ee37a01aed90968474cdc1 (patch)
tree4bf11713fb332acdea0e2256ac50a7e9212b2646
parent4f1525107159cd7f92c18e8060f0333a9c3055b4 (diff)
downloadlibeufin-c3de34f3dae63fd969ee37a01aed90968474cdc1.tar.gz
libeufin-c3de34f3dae63fd969ee37a01aed90968474cdc1.tar.bz2
libeufin-c3de34f3dae63fd969ee37a01aed90968474cdc1.zip
Closing PG connection in more places.
-rw-r--r--util/src/main/kotlin/DB.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/src/main/kotlin/DB.kt b/util/src/main/kotlin/DB.kt
index 90189257..a4ccbda3 100644
--- a/util/src/main/kotlin/DB.kt
+++ b/util/src/main/kotlin/DB.kt
@@ -110,14 +110,17 @@ class PostgresListenHandle(val channelName: String) {
val maybeNotifications = this.conn.getNotifications(timeoutMs.toInt())
if (maybeNotifications == null || maybeNotifications.isEmpty()) {
logger.debug("DB notification channel $channelName was found empty.")
+ conn.close()
return false
}
for (n in maybeNotifications) {
if (n.name.lowercase() != channelName.lowercase()) {
+ conn.close()
throw internalServerError("Channel $channelName got notified from ${n.name}!")
}
}
logger.debug("Found DB notifications on channel $channelName")
+ conn.close()
return true
}
} \ No newline at end of file