packages feed

ngx-export 1.6.3 → 1.6.4

raw patch · 3 files changed

+32/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ NgxExport: data WorkerProcessIsExiting
+ NgxExport: instance GHC.Classes.Eq NgxExport.FinalizeHTTPRequest
+ NgxExport: instance GHC.Classes.Eq NgxExport.RestartWorkerProcess
+ NgxExport: instance GHC.Classes.Eq NgxExport.TerminateWorkerProcess
+ NgxExport: instance GHC.Classes.Eq NgxExport.WorkerProcessIsExiting
+ NgxExport: instance GHC.Exception.Type.Exception NgxExport.WorkerProcessIsExiting
+ NgxExport: instance GHC.Show.Show NgxExport.WorkerProcessIsExiting

Files

Changelog.md view
@@ -1,3 +1,10 @@+### 1.6.4++- Added exception *WorkerProcessIsExiting* to signal services that Nginx is+  shutting down. This has replaced *ThreadKilled* that was used formerly in+  order to prevent erroneous handling of unexpectedly thrown *ThreadKilled*.+- All API exceptions now derive *Eq*.+ ### 1.6.3  - Added API exceptions *RestartWorkerProcess* and *FinalizeHTTPRequest*.
NgxExport.hs view
@@ -50,6 +50,7 @@     -- * Accessing Nginx core functionality from Haskell handlers                  ,TerminateWorkerProcess (..)                  ,RestartWorkerProcess (..)+                 ,WorkerProcessIsExiting                  ,FinalizeHTTPRequest (..)     -- * Re-exported data constructors from /Foreign.C/     -- | Re-exports are needed by exporters for marshalling in foreign calls.@@ -495,6 +496,7 @@ -- @since 1.6.2 newtype TerminateWorkerProcess =     TerminateWorkerProcess String  -- ^ Contains the message to log+    deriving Eq  instance Exception TerminateWorkerProcess instance Show TerminateWorkerProcess where@@ -508,11 +510,26 @@ -- @since 1.6.3 newtype RestartWorkerProcess =     RestartWorkerProcess String  -- ^ Contains the message to log+    deriving Eq  instance Exception RestartWorkerProcess instance Show RestartWorkerProcess where     show (RestartWorkerProcess s) = s +-- | Signals that the worker process is exiting.+--+-- This asynchronous exception is thrown from the Nginx core to all services+-- with 'cancelWith' when the working process is exiting. An exception handler+-- that catches this exception is expected to perform the service's specific+-- cleanup and finalization actions.+--+-- @since 1.6.4+data WorkerProcessIsExiting = WorkerProcessIsExiting deriving (Show, Eq)++instance Exception WorkerProcessIsExiting where+  fromException = asyncExceptionFromException+  toException = asyncExceptionToException+ -- | Finalizes the HTTP request. -- -- Being thrown from an asynchronous variable handler, this exception makes@@ -523,6 +540,7 @@ -- @since 1.6.3 data FinalizeHTTPRequest =     FinalizeHTTPRequest Int (Maybe String)  -- ^ Contains HTTP status and body+    deriving Eq  instance Exception FinalizeHTTPRequest instance Show FinalizeHTTPRequest where@@ -644,7 +662,7 @@                                 0xC0000000 .|. fromIntegral st                             _ -> 1             ,case asyncExceptionFromException e of-                Just ThreadKilled -> True+                Just WorkerProcessIsExiting -> True                 _ -> False             )            )@@ -772,8 +790,10 @@                                     return (True, False)                            )                            `catches`-                           [E.Handler $ return . (, False) . not . isEINTR-                           ,E.Handler $ return . (True, ) . (== ThreadKilled)+                           [E.Handler $+                               return . (, False) . not . isEINTR+                           ,E.Handler $+                               return . (True, ) . (== WorkerProcessIsExiting)                            ]                        else return False         if exiting@@ -928,7 +948,7 @@ ngxExportTerminateTask ::     StablePtr (Async ()) -> IO () ngxExportTerminateTask = deRefStablePtr >=>-    flip cancelWith ThreadKilled+    flip cancelWith WorkerProcessIsExiting  foreign export ccall ngxExportServiceHookInterrupt ::     StablePtr (Async ()) -> IO ()
ngx-export.cabal view
@@ -1,5 +1,5 @@ name:                       ngx-export-version:                    1.6.3+version:                    1.6.4 synopsis:                   Helper module for Nginx haskell module description:                Helper module for         <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>.