ngx-export-tools 0.4.5.0 → 0.4.6.0
raw patch · 3 files changed
+25/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ NgxExport.Tools: workerProcessIsExiting :: SomeException -> Bool
Files
- Changelog.md +6/−0
- NgxExport/Tools.hs +18/−1
- ngx-export-tools.cabal +1/−1
Changelog.md view
@@ -1,3 +1,9 @@+### 0.4.6.0++- Added function *workerProcessIsExiting* to check quickly in an exception+ handler whether a Haskell service has been interrupted because the worker+ process is exiting.+ ### 0.4.5.0 - Added function *ngxPid* to return the PID of the current worker process
NgxExport/Tools.hs view
@@ -22,6 +22,7 @@ terminateWorkerProcess ,restartWorkerProcess ,finalizeHTTPRequest+ ,workerProcessIsExiting ,ngxRequestPtr ,ngxNow ,ngxPid@@ -102,6 +103,14 @@ finalizeHTTPRequest :: Int -> Maybe String -> IO () finalizeHTTPRequest = (throwIO .) . FinalizeHTTPRequest +-- | Checks that a generic exception is of type 'WorkerProcessIsExiting'.+--+-- This can be useful to check quickly in an exception handler whether a+-- Haskell service has been interrupted because the worker process is exiting.+workerProcessIsExiting :: SomeException -> Bool+workerProcessIsExiting e =+ isJust (fromException e :: Maybe WorkerProcessIsExiting)+ -- | Unmarshals the value of Nginx variable __/$_r_ptr/__ into a pointer to -- the Nginx request object. --@@ -126,7 +135,7 @@ ngxNow :: IO CTime ngxNow = ngxCachedTimePtr >>= peek >>= peek . castPtr --- | Returns the /PID/ of the current worker process cached in Nginx.+-- | Returns the /PID/ of the current worker process cached in Nginx core. ngxPid :: IO CPid ngxPid = ngxCachedPid @@ -541,6 +550,14 @@ if hasConf then let (tName, isJSON) = first nameBase $ fromJust c in (mkName $ "storage_" ++ tName ++ '_' : nameF+ -- FIXME: using base name of the type means that it is+ -- not possible to pass here qualified types from+ -- external modules. Using showName instead of nameBase+ -- won't help, as it adds static qualified names like+ -- GHC.Types.Int that can be unexpected in the context+ -- of the user's module scope, instead of adding the+ -- dynamic namespace (possibly not qualified) specified+ -- in the import clause of the user's module. ,conT $ mkName tName ,if isJSON then [|readFromByteStringAsJSON|]
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-tools-version: 0.4.5.0+version: 0.4.6.0 synopsis: Extra tools for Nginx haskell module description: Extra tools for <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>.