feat: Add compatibility with connection poolers on transaction mode

Update the hasql-transaction library to version 1.0.1

Add hints and kill thread at configuration read when using incompatible pooling modes: statement pooling and transaction pooling with prepared statements enabled.
This commit is contained in:
laurenceisla
2021-07-15 13:39:55 -05:00
committed by GitHub
parent 83cc358e1b
commit db95bd1c37
8 changed files with 70 additions and 25 deletions
+4 -3
View File
@@ -25,9 +25,10 @@ queryPgVersion = H.statement mempty $ H.Statement sql HE.noParams versionRow Fal
sql = "SELECT current_setting('server_version_num')::integer, current_setting('server_version')"
versionRow = HD.singleRow $ PgVersion <$> column HD.int4 <*> column HD.text
queryDbSettings :: P.Pool -> IO (Either P.UsageError [(Text, Text)])
queryDbSettings pool =
P.use pool . HT.transaction HT.ReadCommitted HT.Read $
queryDbSettings :: P.Pool -> Bool -> IO (Either P.UsageError [(Text, Text)])
queryDbSettings pool prepared =
let transaction = if prepared then HT.transaction else HT.unpreparedTransaction in
P.use pool . transaction HT.ReadCommitted HT.Read $
HT.statement mempty dbSettingsStatement
-- | Get db settings from the connection role. Global settings will be overridden by database specific settings.