hasql-notifications 0.2.2.2 → 0.2.3.0
raw patch · 2 files changed
+8/−15 lines, 2 filesdep ~bytestringdep ~hasqldep ~hasql-pool
Dependency ranges changed: bytestring, hasql, hasql-pool
Files
- hasql-notifications.cabal +4/−4
- src/Hasql/Notifications.hs +4/−11
hasql-notifications.cabal view
@@ -1,5 +1,5 @@ name: hasql-notifications-version: 0.2.2.2+version: 0.2.3.0 synopsis: LISTEN/NOTIFY support for Hasql description: Use PostgreSQL Asynchronous notification support with your Hasql Types. homepage: https://github.com/diogob/hasql-notifications@@ -17,12 +17,12 @@ hs-source-dirs: src exposed-modules: Hasql.Notifications build-depends: base >= 4.7 && < 5- , bytestring >= 0.10.8.2+ , bytestring >= 0.10.8.2 && < 0.12 , text >= 2 && < 2.2- , hasql-pool >= 0.4.3.1 && < 1.1+ , hasql-pool >= 1.2 && < 1.3 , bytestring >= 0.10 , postgresql-libpq >= 0.9 && < 1.0- , hasql >= 0.19+ , hasql >= 0.19 && < 1.8 default-language: Haskell2010 ghc-options: -Wall
src/Hasql/Notifications.hs view
@@ -17,11 +17,8 @@ FatalError (..), ) where-#if defined(mingw32_HOST_OS)-import Control.Concurrent ( threadDelay )-#else-import Control.Concurrent (threadWaitRead, threadDelay)-#endif++import Control.Concurrent (threadDelay, threadWaitRead) import Control.Exception (Exception, throw) import Control.Monad (forever, unless, void, when) import Data.ByteString.Char8 (ByteString)@@ -84,7 +81,7 @@ PgIdentifier -> -- | Payload to be sent with the notification Text ->- IO (Either S.QueryError ())+ IO (Either S.SessionError ()) notify con channel mesg = run (sql $ T.encodeUtf8 ("NOTIFY " <> fromPgIdentifier channel <> ", '" <> mesg <> "'")) con @@ -193,13 +190,9 @@ mfd <- PQ.socket pqCon case mfd of Nothing -> void $ threadDelay 1000000-#if defined(mingw32_HOST_OS)- Just _ -> do- void $ threadDelay 1000000-#else Just fd -> do void $ threadWaitRead fd-#endif+ result <- PQ.consumeInput pqCon unless result $ do mError <- PQ.errorMessage pqCon