diff --git a/backend/src/app/db.clj b/backend/src/app/db.clj index 8871764b1..8bda9e1d0 100644 --- a/backend/src/app/db.clj +++ b/backend/src/app/db.clj @@ -155,8 +155,18 @@ (.isClosed ^HikariDataSource pool)) (defn read-only? - [pool] - (.isReadOnly ^HikariDataSource pool)) + [pool-or-conn] + (cond + (instance? HikariDataSource pool-or-conn) + (.isReadOnly ^HikariDataSource pool-or-conn) + + (instance? Connection pool-or-conn) + (.isReadOnly ^Connection pool-or-conn) + + :else + (ex/raise :type :internal + :code :invalid-connection + :hint "invalid connection provided"))) (defn create-pool [cfg]