packages feed

ngx-export-tools 1.2.5 → 1.2.6

raw patch · 4 files changed

+47/−10 lines, 4 files

Files

Changelog.md view
@@ -1,3 +1,14 @@+### 1.2.6++- Service *voidService* was reimplemented as a *split* service with the first+  iteration being very short and the next iteration being as long as the whole+  lifetime of the worker process. This implementation addresses the problem of+  deliberate altering loaded data in the code.+- Add *restartPromptly* declaration to replace *rareService* which was+  recommended to use with *voidService* in the previous release. Note, however,+  that use of *rareService* is still valid for loading global data with+  *voidService*.+ ### 1.2.5  - Add new exporters of typed simple services *ngxExportSimpleServiceTyped'* and
NgxExport/Tools/Combinators.hs view
@@ -20,6 +20,7 @@                                    ,voidHandler'                                    ,voidService                                    ,rareService+                                   ,restartPromptly     -- * Split services                                    ,module NgxExport.Tools.SplitService                                    ) where@@ -29,6 +30,7 @@ import           NgxExport.Tools.TimeInterval  import qualified Data.ByteString.Lazy as L+import           Control.Monad  -- $description --@@ -100,9 +102,14 @@  -- | A void service which does nothing and returns an empty 'L.ByteString'. ----- This can be useful for loading global data from the Nginx configuration in--- a more concise and declarative way.+-- The service is implemented as a /split/ service in terms of module+-- "NgxExport.Tools.SplitService". On the first iteration the service returns+-- immediately, on the next iteration it sleeps until the worker process+-- terminates it during the shutdown. --+-- This can be used for loading global data from the Nginx configuration in a+-- more concise and declarative way.+-- -- For example, if data /Conf/ in -- -- @@@ -111,13 +118,17 @@ -- testLoadConf :: Conf -> t'NgxExport.Tools.Types.NgxExportService' -- testLoadConf = __/voidService/__ ----- 'ngxExportSimpleServiceTyped' \'testLoadConf \'\'Conf 'rareService'+-- 'ngxExportSimpleServiceTyped' \'testLoadConf \'\'Conf 'restartPromptly' -- @ -- -- gets loaded by service /testLoadConf/ from the Nginx configuration, then it -- can be accessed in the Haskell code via t'Data.IORef.IORef' data storage -- /storage_Conf_testLoadConf/. --+-- Declaration of 'restartPromptly' establishes a /persistent/ service mode+-- without delay. The short iteration at the start of the service can be used+-- for calling a /service update hook/.+-- -- Note that /voidService/ is still an /asynchronous/ service which means that -- the global data it loads may appear uninitialized in very early client -- requests. To ensure that the data gets loaded before processing client@@ -129,14 +140,25 @@ voidService :: a                            -- ^ Ignored configuration             -> Bool                         -- ^ Ignored boolean value             -> IO L.ByteString-voidService = const $ voidHandler' $ return ()+voidService = splitService (const $ return L.empty) $+    const $ forever $ threadDelaySec $ toSec $ Hr 24 --- | A rare service mode.+-- | A persistent service which waits for 24 hours before restart. ----- A service that sleeps most of the time. Use this convenient declaration for--- loading global data from the Nginx configuration with 'voidService'. Services--- with a more natural 'SingleShotService' strategy do not create storages and--- thus cannot be used for this purpose.+-- This declaration had been recommended for using with 'voidService' until the+-- latter was reimplemented as a split service. Nevertheless, it still can be+-- used for this purpose.+--+-- @since 1.2.5 rareService :: ServiceMode rareService = PersistentService $ Just $ Hr 24++-- | A persistent service which restarts without delay.+--+-- This convenient declaration can be used for loading global data from the+-- Nginx configuration with 'voidService'.+--+-- @since 1.2.6+restartPromptly :: ServiceMode+restartPromptly = PersistentService Nothing 
NgxExport/Tools/SimpleService.hs view
@@ -493,6 +493,8 @@ -- store data in a global storage for persistent services. Use this exporter -- when multiple instances of the service with different configurations are -- required.+--+-- @since 1.2.5 ngxExportSimpleServiceTyped' :: Name         -- ^ Name of the service                              -> Name         -- ^ Name of the custom type                              -> ServiceMode  -- ^ Service mode@@ -512,6 +514,8 @@ -- does not store data in a global storage for persistent services. Use this -- exporter when multiple instances of the service with different configurations -- are required.+--+-- @since 1.2.5 ngxExportSimpleServiceTypedAsJSON' :: Name         -- ^ Name of the service                                    -> Name         -- ^ Name of the custom type                                    -> ServiceMode  -- ^ Service mode
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name:                       ngx-export-tools-version:                    1.2.5+version:                    1.2.6 synopsis:                   Extra tools for Nginx Haskell module description:                Extra tools for         <https://github.com/lyokha/nginx-haskell-module Nginx Haskell module>.