wolf 0.2.9 → 0.2.10
raw patch · 2 files changed
+9/−6 lines, 2 filesdep +stm
Dependencies added: stm
Files
- main/Act2.hs +7/−5
- wolf.cabal +2/−1
main/Act2.hs view
@@ -8,6 +8,7 @@ import Codec.Compression.GZip import Control.Concurrent import Control.Concurrent.Async+import Control.Concurrent.STM import Control.Monad.Trans.Resource import Data.Aeson.Encode import Data.ByteString ( length )@@ -110,11 +111,11 @@ cd dir maybe (return ()) (uncurry $ run_ . fromText) $ uncons $ words cmdline -watchdog :: MVar UTCTime -> Int -> IO ()+watchdog :: TVar UTCTime -> Int -> IO () watchdog timestamp duration = forever $ do now <- getCurrentTime- now' <- readMVar timestamp+ now' <- atomically $ readTVar timestamp when (diffUTCTime now now' > fromIntegral duration) $ throwIO $ userError "watchdog expired" threadDelay 1000000@@ -123,10 +124,11 @@ call Args{..} = do config <- decodeFile aConfig >>= maybeThrow (userError "Bad Config") env <- flowEnv config- timestamp <- newEmptyMVar- void $ concurrently (watchdog timestamp aTimeout) $ do+ now <- getCurrentTime+ timestamp <- atomically $ newTVar now+ void $ concurrently (watchdog timestamp aTimeout) $ forever $ runResourceT $ runFlowT env $ do- liftIO $ getCurrentTime >>= putMVar timestamp+ liftIO $ getCurrentTime >>= atomically . writeTVar timestamp act aQueue $ exec aCommandLine main :: IO ()
wolf.cabal view
@@ -1,5 +1,5 @@ name: wolf-version: 0.2.9+version: 0.2.10 synopsis: Amazon Simple Workflow Service Wrapper. homepage: https://github.com/swift-nav/wolf license: MIT@@ -177,6 +177,7 @@ , optparse-applicative , resourcet , shelly+ , stm , system-filepath , text , time