packages feed

ngx-export-tools 0.4.0.0 → 0.4.1.0

raw patch · 3 files changed

+40/−38 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Changelog.md view
@@ -1,3 +1,7 @@+### 0.4.1.0++- Improvements in code generation of simple services.+ ### 0.4.0.0  - Now services with *SingleShotService* strategy run exactly two times during
NgxExport/Tools.hs view
@@ -164,8 +164,7 @@ -- -- Below is a toy example. ----- File __/test_tools.hs/__.---+-- ==== File /test_tools.hs/ -- @ -- {-\# LANGUAGE TemplateHaskell, DeriveGeneric \#-} --@@ -221,8 +220,7 @@ -- /testReadConfWithRPtrHandler/, and /testReadConfWithRPtrJSONHandler/. Four -- of them are /synchronous/ and one is /asynchronous/ for the sake of variety. ----- File __/nginx.conf/__.---+-- ==== File /nginx.conf/ -- @ -- user                    nobody; -- worker_processes        2;@@ -277,8 +275,7 @@ -- } -- @ ----- Let's run a simple test.---+-- ==== A simple test -- > $ curl 'http://localhost:8010/' -- > Handler variables: -- >   hs_testReadIntHandler: Just (-456)@@ -339,8 +336,7 @@ -- -- Below is a toy example. ----- File __/test_tools.hs/__.---+-- ==== File /test_tools.hs/ -- @ -- {-\# LANGUAGE TemplateHaskell, DeriveGeneric, RecordWildCards \#-} --@@ -436,8 +432,7 @@ -- Notice that service /testReadConfWithDelay/ manages time delays on its own, -- therefore it uses /no-sleeps/ strategy @'PersistentService' Nothing@. ----- File __/nginx.conf/__.---+-- ==== File /nginx.conf/ -- @ -- user                    nobody; -- worker_processes        2;@@ -497,8 +492,7 @@ -- Notice that Haskel handlers defined in /test_tools.hs/ are referred from -- the Nginx configuration file with prefix __/simpleService_/__. ----- Let's run a simple test.---+-- ==== A simple test -- > $ curl 'http://localhost:8010/' -- > Service variables: -- >   hs_test: test@@ -540,16 +534,17 @@             in if hasConf                    then let storage = varE sNameC                         in [|readIORef $(storage) >>=-                                 maybe (do-                                            let conf_data__ =-                                                    $(readConf) $(eConfBs)-                                            when (isNothing conf_data__) $-                                                throwIO $-                                                    TerminateWorkerProcess-                                                        $(unreadableConfMsg)-                                            writeIORef $(storage) conf_data__-                                            return conf_data__-                                       ) (return . Just)+                                 maybe+                                     (do+                                          let conf_data__ =+                                                  $(readConf) $(eConfBs)+                                          when (isNothing conf_data__) $+                                              throwIO $+                                                  TerminateWorkerProcess+                                                      $(unreadableConfMsg)+                                          writeIORef $(storage) conf_data__+                                          return conf_data__+                                     ) (return . Just)                            |]                    else [|return $                               fromByteString (Nothing :: Maybe ByteString)@@ -562,26 +557,25 @@                    PersistentService i ->                        (if isJust i                             then let t = fromJust i-                                 in [|unless $(eFstRun) $-                                          threadDelaySec $ toSec t+                                 in [|const $+                                          unless $(eFstRun) $+                                              threadDelaySec $ toSec t                                     |]-                            else [|return ()|]-                       ,[|\conf_data__ ->-                              $(eF) (fromJust conf_data__) $(eFstRun)-                        |]+                            else [|const $ return ()|]+                       ,[|\conf_data__ -> $(eF) conf_data__ $(eFstRun)|]                        )                    SingleShotService ->-                       ([|unless $(eFstRun) $ handle-                              (\case-                                   ThreadKilled -> do-                                       conf_data__ <- $(initConf)-                                       void $ $(eF) (fromJust conf_data__) False-                                   _ -> return ()-                              ) $ forever $ threadDelaySec $ toSec $ Hr 24+                       ([|\conf_data__ -> unless $(eFstRun) $+                              handle+                                  (\case+                                       ThreadKilled -> void $+                                           $(eF) conf_data__ False+                                       _ -> return ()+                                  ) $ forever $ threadDelaySec $ toSec $ Hr 24                         |]                        ,[|\conf_data__ ->                               if $(eFstRun)-                                  then $(eF) (fromJust conf_data__) True+                                  then $(eF) conf_data__ True                                   else return L.empty                         |]                        )@@ -605,7 +599,11 @@             [sigD nameSsf [t|ByteString -> Bool -> IO L.ByteString|]             ,funD nameSsf                 [clause [varP confBs, varP fstRun]-                    (normalB [|$(waitTime) >> $(initConf) >>= $(runService)|])+                    (normalB [|do+                                   conf_data_ <- fromJust <$> $(initConf)+                                   $(waitTime) conf_data_+                                   $(runService) conf_data_+                             |])                     []                 ]             ]
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name:                       ngx-export-tools-version:                    0.4.0.0+version:                    0.4.1.0 synopsis:                   Extra tools for Nginx haskell module description:                Extra tools for         <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>.