consumers 2.3.3.1 → 2.3.4.0
raw patch · 5 files changed
+13/−20 lines, 5 filesdep −transformersdep ~basedep ~hpqtypesdep ~hpqtypes-extrasPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: transformers
Dependency ranges changed: base, hpqtypes, hpqtypes-extras
API changes (from Hackage documentation)
- Database.PostgreSQL.Consumers.Config: instance GHC.Show.Show Database.PostgreSQL.Consumers.Config.Action
- Database.PostgreSQL.Consumers.Config: instance GHC.Show.Show Database.PostgreSQL.Consumers.Config.Result
- Database.PostgreSQL.Consumers.Consumer: instance GHC.Show.Show Database.PostgreSQL.Consumers.Consumer.ConsumerID
- Database.PostgreSQL.Consumers.Utils: instance GHC.Exception.Type.Exception Database.PostgreSQL.Consumers.Utils.StopExecution
- Database.PostgreSQL.Consumers.Utils: instance GHC.Exception.Type.Exception Database.PostgreSQL.Consumers.Utils.ThrownFrom
- Database.PostgreSQL.Consumers.Utils: instance GHC.Show.Show Database.PostgreSQL.Consumers.Utils.StopExecution
- Database.PostgreSQL.Consumers.Utils: instance GHC.Show.Show Database.PostgreSQL.Consumers.Utils.ThrownFrom
+ Database.PostgreSQL.Consumers.Config: instance GHC.Internal.Show.Show Database.PostgreSQL.Consumers.Config.Action
+ Database.PostgreSQL.Consumers.Config: instance GHC.Internal.Show.Show Database.PostgreSQL.Consumers.Config.Result
+ Database.PostgreSQL.Consumers.Consumer: instance GHC.Internal.Show.Show Database.PostgreSQL.Consumers.Consumer.ConsumerID
+ Database.PostgreSQL.Consumers.Utils: instance GHC.Internal.Exception.Type.Exception Database.PostgreSQL.Consumers.Utils.StopExecution
+ Database.PostgreSQL.Consumers.Utils: instance GHC.Internal.Exception.Type.Exception Database.PostgreSQL.Consumers.Utils.ThrownFrom
+ Database.PostgreSQL.Consumers.Utils: instance GHC.Internal.Show.Show Database.PostgreSQL.Consumers.Utils.StopExecution
+ Database.PostgreSQL.Consumers.Utils: instance GHC.Internal.Show.Show Database.PostgreSQL.Consumers.Utils.ThrownFrom
- Database.PostgreSQL.Consumers.Components: spawnDispatcher :: forall m idx job. (MonadBaseControl IO m, MonadLog m, MonadMask m, MonadTime m, Show idx, ToSQL idx) => ConsumerConfig m idx job -> ConnectionSourceM m -> ConsumerID -> MVar () -> TVar (Map ThreadId idx) -> TVar Int -> Maybe (TMVar Bool) -> m ThreadId
+ Database.PostgreSQL.Consumers.Components: spawnDispatcher :: (MonadBaseControl IO m, MonadLog m, MonadMask m, MonadTime m, Show idx, ToSQL idx) => ConsumerConfig m idx job -> ConnectionSourceM m -> ConsumerID -> MVar () -> TVar (Map ThreadId idx) -> TVar Int -> Maybe (TMVar Bool) -> m ThreadId
- Database.PostgreSQL.Consumers.Components: spawnMonitor :: forall m idx job. (MonadBaseControl IO m, MonadLog m, MonadMask m, MonadTime m, Show idx, FromSQL idx, ToSQL idx) => ConsumerConfig m idx job -> ConnectionSourceM m -> ConsumerID -> m ThreadId
+ Database.PostgreSQL.Consumers.Components: spawnMonitor :: (MonadBaseControl IO m, MonadLog m, MonadMask m, MonadTime m, Show idx, FromSQL idx, ToSQL idx) => ConsumerConfig m idx job -> ConnectionSourceM m -> ConsumerID -> m ThreadId
- Database.PostgreSQL.Consumers.Config: ConsumerConfig :: !RawSQL () -> !RawSQL () -> ![SQL] -> !row -> job -> !job -> idx -> !Maybe Channel -> !Int -> !Int -> !job -> m Result -> !SomeException -> job -> m Action -> !job -> [Pair] -> ConsumerConfig m idx job
+ Database.PostgreSQL.Consumers.Config: ConsumerConfig :: !RawSQL () -> !RawSQL () -> ![SQL] -> !row -> job -> !job -> idx -> !Maybe Channel -> !Int -> !Int -> !job -> m Result -> !SomeException -> job -> m Action -> !job -> [Pair] -> ConsumerConfig (m :: Type -> Type) idx job
- Database.PostgreSQL.Consumers.Config: [ccConsumersTable] :: ConsumerConfig m idx job -> !RawSQL ()
+ Database.PostgreSQL.Consumers.Config: [ccConsumersTable] :: ConsumerConfig (m :: Type -> Type) idx job -> !RawSQL ()
- Database.PostgreSQL.Consumers.Config: [ccJobFetcher] :: ConsumerConfig m idx job -> !row -> job
+ Database.PostgreSQL.Consumers.Config: [ccJobFetcher] :: ConsumerConfig (m :: Type -> Type) idx job -> !row -> job
- Database.PostgreSQL.Consumers.Config: [ccJobIndex] :: ConsumerConfig m idx job -> !job -> idx
+ Database.PostgreSQL.Consumers.Config: [ccJobIndex] :: ConsumerConfig (m :: Type -> Type) idx job -> !job -> idx
- Database.PostgreSQL.Consumers.Config: [ccJobLogData] :: ConsumerConfig m idx job -> !job -> [Pair]
+ Database.PostgreSQL.Consumers.Config: [ccJobLogData] :: ConsumerConfig (m :: Type -> Type) idx job -> !job -> [Pair]
- Database.PostgreSQL.Consumers.Config: [ccJobSelectors] :: ConsumerConfig m idx job -> ![SQL]
+ Database.PostgreSQL.Consumers.Config: [ccJobSelectors] :: ConsumerConfig (m :: Type -> Type) idx job -> ![SQL]
- Database.PostgreSQL.Consumers.Config: [ccJobsTable] :: ConsumerConfig m idx job -> !RawSQL ()
+ Database.PostgreSQL.Consumers.Config: [ccJobsTable] :: ConsumerConfig (m :: Type -> Type) idx job -> !RawSQL ()
- Database.PostgreSQL.Consumers.Config: [ccMaxRunningJobs] :: ConsumerConfig m idx job -> !Int
+ Database.PostgreSQL.Consumers.Config: [ccMaxRunningJobs] :: ConsumerConfig (m :: Type -> Type) idx job -> !Int
- Database.PostgreSQL.Consumers.Config: [ccNotificationChannel] :: ConsumerConfig m idx job -> !Maybe Channel
+ Database.PostgreSQL.Consumers.Config: [ccNotificationChannel] :: ConsumerConfig (m :: Type -> Type) idx job -> !Maybe Channel
- Database.PostgreSQL.Consumers.Config: [ccNotificationTimeout] :: ConsumerConfig m idx job -> !Int
+ Database.PostgreSQL.Consumers.Config: [ccNotificationTimeout] :: ConsumerConfig (m :: Type -> Type) idx job -> !Int
- Database.PostgreSQL.Consumers.Config: [ccOnException] :: ConsumerConfig m idx job -> !SomeException -> job -> m Action
+ Database.PostgreSQL.Consumers.Config: [ccOnException] :: ConsumerConfig (m :: Type -> Type) idx job -> !SomeException -> job -> m Action
- Database.PostgreSQL.Consumers.Config: [ccProcessJob] :: ConsumerConfig m idx job -> !job -> m Result
+ Database.PostgreSQL.Consumers.Config: [ccProcessJob] :: ConsumerConfig (m :: Type -> Type) idx job -> !job -> m Result
- Database.PostgreSQL.Consumers.Config: data ConsumerConfig m idx job
+ Database.PostgreSQL.Consumers.Config: data ConsumerConfig (m :: Type -> Type) idx job
- Database.PostgreSQL.Consumers.Consumer: registerConsumer :: (MonadBase IO m, MonadMask m, MonadTime m) => ConsumerConfig n idx job -> ConnectionSourceM m -> m ConsumerID
+ Database.PostgreSQL.Consumers.Consumer: registerConsumer :: forall m (n :: Type -> Type) idx job. (MonadBase IO m, MonadMask m, MonadTime m) => ConsumerConfig n idx job -> ConnectionSourceM m -> m ConsumerID
- Database.PostgreSQL.Consumers.Consumer: unregisterConsumer :: (MonadBase IO m, MonadMask m) => ConsumerConfig n idx job -> ConnectionSourceM m -> ConsumerID -> m ()
+ Database.PostgreSQL.Consumers.Consumer: unregisterConsumer :: forall m (n :: Type -> Type) idx job. (MonadBase IO m, MonadMask m) => ConsumerConfig n idx job -> ConnectionSourceM m -> ConsumerID -> m ()
Files
- CHANGELOG.md +3/−0
- README.md +1/−1
- consumers.cabal +5/−6
- src/Database/PostgreSQL/Consumers/Components.hs +2/−6
- src/Database/PostgreSQL/Consumers/Consumer.hs +2/−7
CHANGELOG.md view
@@ -1,3 +1,6 @@+# consumers-2.3.4.0 (2025-11-27)+* Compatibility with `hpqtypes` >= 1.13.0.0.+ # consumers-2.3.3.1 (2025-04-03) * Do not prepare query that updates jobs in the monitor thread.
README.md view
@@ -1,7 +1,7 @@ # consumers -[](https://hackage.haskell.org/package/consumers) [](https://github.com/scrive/consumers/actions/workflows/haskell-ci.yml)+[](https://hackage.haskell.org/package/consumers) Library for setting up concurrent consumers of data stored inside PostgreSQL database in a simple, declarative manner.
consumers.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: consumers-version: 2.3.3.1+version: 2.3.4.0 synopsis: Concurrent PostgreSQL data consumers description: Library for setting up concurrent consumers of data@@ -17,7 +17,7 @@ copyright: Scrive AB category: Concurrency, Database build-type: Simple-tested-with: GHC == { 8.10.7, 9.0.2, 9.2.8, 9.4.8, 9.6.6, 9.8.4, 9.10.1, 9.12.1 }+tested-with: GHC == { 9.2.8, 9.4.8, 9.6.7, 9.8.4, 9.10.3, 9.12.2, 9.14.1 } bug-reports: https://github.com/scrive/consumers/issues source-repository head@@ -53,11 +53,11 @@ Database.PostgreSQL.Consumers.Components, Database.PostgreSQL.Consumers.Utils - build-depends: base >= 4.14 && < 5+ build-depends: base >= 4.16 && < 5 , aeson >= 2.0 , containers >= 0.5 , exceptions >= 0.10- , hpqtypes >= 1.11+ , hpqtypes >= 1.13 , lifted-base >= 0.2 , lifted-threads >= 1.0 , log-base >= 0.11@@ -99,7 +99,7 @@ exceptions, HUnit, hpqtypes,- hpqtypes-extras,+ hpqtypes-extras >= 1.19.0.0, log-base, monad-control, monad-time,@@ -107,7 +107,6 @@ stm, text, time,- transformers, transformers-base hs-source-dirs: test
src/Database/PostgreSQL/Consumers/Components.hs view
@@ -190,7 +190,8 @@ forkP "listener" $ case ccNotificationChannel cc of Just chan ->- runDBT cs noTs+ runDBT cs defaultTransactionSettings+ . unsafeWithoutTransaction . bracket_ (listen chan) (unlisten chan) . forever $ do@@ -206,11 +207,6 @@ where signalDispatcher = do liftBase $ tryPutMVar semaphore ()-- noTs =- defaultTransactionSettings- { tsAutoTransaction = False- } -- | Spawn a thread that monitors working consumers for activity and -- periodically updates its own.
src/Database/PostgreSQL/Consumers/Consumer.hs view
@@ -36,7 +36,7 @@ => ConsumerConfig n idx job -> ConnectionSourceM m -> m ConsumerID-registerConsumer ConsumerConfig {..} cs = runDBT cs ts $ do+registerConsumer ConsumerConfig {..} cs = runDBT cs defaultTransactionSettings $ do now <- currentTime runPreparedSQL_ (preparedSqlName "registerConsumer" ccConsumersTable) $ smconcat@@ -45,11 +45,6 @@ , "RETURNING id" ] fetchOne runIdentity- where- ts =- defaultTransactionSettings- { tsAutoTransaction = False- } -- | Unregister consumer with a given ID. unregisterConsumer@@ -60,7 +55,7 @@ -> m () unregisterConsumer ConsumerConfig {..} cs wid = runDBT cs ts $ do -- Free tasks manually in case there is no foreign key constraint on- -- reserved_by,+ -- reserved_by. runPreparedSQL_ (preparedSqlName "deregisterJobs" ccJobsTable) $ smconcat [ "UPDATE" <+> raw ccJobsTable