File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ library
4444 , bytestring >= 0.11.5 && < 0.13
4545 , either >= 5.0.1.1 && < 5.1
4646 , envparse >= 0.5.0 && < 0.7
47- , hasql >= 1.7 && < 1.9
48- , hasql-notifications >= 0.2.3 .0 && < 0.3
49- , hasql-pool ^>= 1.2
47+ , hasql >= 1.9 && < 1.10
48+ , hasql-notifications >= 0.2.4 .0 && < 0.3
49+ , hasql-pool ^>= 1.3
5050 , http-types >= 0.12.3 && < 0.13
5151 , jose >= 0.11 && < 0.12
5252 , lens >= 5.2.3 && < 5.4
@@ -94,9 +94,9 @@ test-suite postgres-websockets-test
9494 , postgres-websockets
9595 , hspec >= 2.7.1 && < 2.12
9696 , aeson >= 2.0 && < 2.3
97- , hasql >= 1.7 && < 1.9
98- , hasql-pool ^>= 1.2
99- , hasql-notifications >= 0.2.3 .0 && < 0.3
97+ , hasql >= 1.9 && < 1.10
98+ , hasql-pool ^>= 1.3
99+ , hasql-notifications >= 0.2.4 .0 && < 0.3
100100 , http-types >= 0.9
101101 , time >= 1.8.0.2 && < 1.13
102102 , unordered-containers >= 0.2
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import Control.AutoUpdate
1616import Data.Time.Clock (UTCTime , getCurrentTime )
1717import qualified Hasql.Pool as P
1818import qualified Hasql.Pool.Config as P
19+ import qualified Hasql.Connection.Setting as C
20+ import qualified Hasql.Connection.Setting.Connection as C
1921import PostgresWebsockets.Broadcast (Multiplexer )
2022import PostgresWebsockets.Config (AppConfig (.. ))
2123import PostgresWebsockets.HasqlBroadcast (newHasqlBroadcaster )
@@ -35,7 +37,7 @@ mkContext conf@AppConfig {..} shutdownServer = do
3537 <*> newHasqlBroadcaster shutdown configListenChannel configRetries configReconnectInterval pgSettings
3638 <*> mkGetTime
3739 where
38- config = P. settings [P. staticConnectionSettings pgSettings]
40+ config = P. settings [P. staticConnectionSettings [ C. connection $ C. string $ decodeUtf8 pgSettings] ]
3941 shutdown =
4042 maybe
4143 shutdownServer
Original file line number Diff line number Diff line change @@ -21,14 +21,19 @@ import Data.Aeson (Value (..), decode)
2121import qualified Data.Aeson.Key as Key
2222import qualified Data.Aeson.KeyMap as JSON
2323import Data.Either.Combinators (mapBoth )
24- import Hasql.Connection
24+ import Hasql.Connection (Connection , ConnectionError )
25+ import qualified Hasql.Connection as HC
26+ import qualified Hasql.Connection.Setting as HC
27+ import qualified Hasql.Connection.Setting.Connection as HC
2528import qualified Hasql.Decoders as HD
2629import qualified Hasql.Encoders as HE
2730import Hasql.Notifications
2831import qualified Hasql.Session as H
2932import qualified Hasql.Statement as H
3033import PostgresWebsockets.Broadcast
3134
35+ acquire :: ByteString -> IO (Either ConnectionError Connection )
36+ acquire settings = HC. acquire [HC. connection $ HC. string $ decodeUtf8 settings]
3237-- | Returns a multiplexer from a connection URI, keeps trying to connect in case there is any error.
3338-- This function also spawns a thread that keeps relaying the messages from the database to the multiplexer's listeners
3439newHasqlBroadcaster :: IO () -> Text -> Int -> Maybe Int -> ByteString -> IO Multiplexer
You can’t perform that action at this time.
0 commit comments