watchdog 0.2.2.1 → 0.2.3
raw patch · 2 files changed
+13/−14 lines, 2 filesdep ~mtldep ~time
Dependency ranges changed: mtl, time
Files
- Control/Watchdog.hs +9/−7
- watchdog.cabal +4/−7
Control/Watchdog.hs view
@@ -1,6 +1,6 @@ -- | -- How to use:--- +-- -- > import Control.Watchdog -- > import Data.Time -- >@@ -99,15 +99,16 @@ , WatchdogAction ) where +import Control.Applicative import Control.Concurrent import Control.Monad.State.Strict import Data.Time -data WatchdogState = WatchdogState { wcInitialDelay :: Int- , wcMaximumDelay :: Int- , wcResetDuration :: Int+data WatchdogState = WatchdogState { wcInitialDelay :: Int+ , wcMaximumDelay :: Int+ , wcResetDuration :: Int , wcMaximumRetries :: Integer- , wcLoggingAction :: WatchdogLogger+ , wcLoggingAction :: WatchdogLogger } data WatchdogTaskStatus a = FailedImmediately String@@ -115,7 +116,8 @@ | CompletedSuccessfully a newtype WatchdogAction a = WA { runWA :: StateT WatchdogState IO a }- deriving (Monad, MonadIO, MonadState WatchdogState)+ deriving ( Functor, Applicative, Alternative+ , Monad, MonadIO, MonadState WatchdogState) -- | Type synonym for a watchdog logger. type WatchdogLogger = String -- ^ Error message returned by the task.@@ -274,7 +276,7 @@ stop <- getCurrentTime case status of Right result -> return $ CompletedSuccessfully result- Left err -> + Left err -> let cutOff = fromIntegral resetDuration / 10 ^ (6 :: Integer) in if diffUTCTime stop start < cutOff then return $ FailedImmediately err
watchdog.cabal view
@@ -1,7 +1,7 @@ name: watchdog-version: 0.2.2.1+version: 0.2.3 author: Jan Vornberger <jan@uos.de>-copyright: (c) 2012 - 2014 Jan Vornberger+copyright: (c) 2012 - 2017 Jan Vornberger maintainer: Jan Vornberger <jan@uos.de> synopsis: Simple control structure to re-try an action with exponential backoff description: See Control.Watchdog for documentation.@@ -18,10 +18,7 @@ library build-depends: base == 4.*- -- Wheezy: 4.5.0.0 (ghc)- , time == 1.4.*- -- Wheezy: 1.4.1 (ghc)- , mtl == 2.1.*- -- Wheezy: 2.1.1 (libghc-mtl-dev)+ , time >= 1.4 && < 1.9+ , mtl >= 2.1 && < 2.3 exposed-modules: Control.Watchdog ghc-options: -Wall