packages feed

freckle-app 1.26.1.0 → 1.26.2.0

raw patch · 4 files changed

+29/−3 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Freckle.App.Faktory.ProducerPool: withFaktoryProducerPool :: MonadUnliftIO m => Settings -> FaktoryProducerPoolConfig -> (FaktoryProducerPool -> m a) -> m a

Files

CHANGELOG.md view
@@ -1,4 +1,11 @@-## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-app-v1.26.1.0...main)+## [_Unreleased_](https://github.com/freckle/freckle-app/compare/freckle-app-v1.26.2.0...main)++## [v1.26.2.0](https://github.com/freckle/freckle-app/compare/freckle-app-v1.26.1.0...freckle-app-v1.26.2.0)++- Add `withFaktoryProducerPool`, which creates a Faktory producer pool and+  closes it with `destroyAllResources` once the given action completes.+  Prefer this to `createFaktoryProducerPool`, which leaves the pool open+  for the caller to close.  ## [v1.26.1.0](https://github.com/freckle/freckle-app/compare/freckle-app-v1.26.0.0...freckle-app-v1.26.1.0) 
freckle-app.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               freckle-app-version:            1.26.1.0+version:            1.26.2.0 license:            MIT license-file:       LICENSE maintainer:         Freckle Education
library/Freckle/App/Faktory/ProducerPool.hs view
@@ -5,6 +5,7 @@   , FaktoryProducerPoolConfig (..)   , envFaktoryProducerPoolConfig   , HasFaktoryProducerPool (..)+  , withFaktoryProducerPool   , createFaktoryProducerPool   ) where @@ -14,12 +15,14 @@ import Data.Pool   ( Pool   , defaultPoolConfig+  , destroyAllResources   , newPool   , setNumStripes   ) import Faktory.Producer qualified as Faktory import Faktory.Settings qualified as Faktory import Freckle.App.Env qualified as Env+import UnliftIO.Exception (bracket) import Yesod.Core.Lens (envL, siteL) import Yesod.Core.Types (HandlerData) @@ -63,6 +66,22 @@ instance HasFaktoryProducerPool site => HasFaktoryProducerPool (HandlerData child site) where   faktoryProducerPoolL = envL . siteL . faktoryProducerPoolL +-- | Create a Faktory producer pool, closing it once the given action completes+withFaktoryProducerPool+  :: MonadUnliftIO m+  => Faktory.Settings+  -> FaktoryProducerPoolConfig+  -> (FaktoryProducerPool -> m a)+  -> m a+withFaktoryProducerPool faktorySettings poolConfig =+  bracket+    (liftIO $ createFaktoryProducerPool faktorySettings poolConfig)+    (liftIO . destroyAllResources)++-- | Create a Faktory producer pool from the given settings and config+--+-- Prefer 'withFaktoryProducerPool', which closes the pool with+-- 'destroyAllResources' once the given action completes. createFaktoryProducerPool   :: Faktory.Settings -> FaktoryProducerPoolConfig -> IO FaktoryProducerPool createFaktoryProducerPool faktorySettings poolConfig =
package.yaml view
@@ -1,5 +1,5 @@ name: freckle-app-version: 1.26.1.0+version: 1.26.2.0  maintainer: Freckle Education category: Utils