summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlorenzo <>2017-09-13 12:41:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-09-13 12:41:00 (GMT)
commit4f6d44138c63fbefb68d70f1d1c5ed662ed89d83 (patch)
tree61121e711a39803a9a0922b3d806678349b29922
parenta0838f88115724ce3b5ed40a9d6df1e7ede89106 (diff)
version 1.2.2.0HEAD1.2.2.0master
-rw-r--r--src/Wrecker/Runner.hs25
-rw-r--r--wrecker.cabal2
2 files changed, 14 insertions, 13 deletions
diff --git a/src/Wrecker/Runner.hs b/src/Wrecker/Runner.hs
index 4702a5c..3e54631 100644
--- a/src/Wrecker/Runner.hs
+++ b/src/Wrecker/Runner.hs
@@ -86,19 +86,12 @@ runAction logger timeoutTime concurrency runStyle action env = do
recorderRef <- newIORef $ recorder env
let takeRecorder = atomicModifyIORef' recorderRef $ \x -> (Recorder.split x, x)
actionThread =
- void $
BoundedThreadGroup.forkIO threadLimit $ do
- rec <- takeRecorder
- handle
- (\e -> do
- case fromException e of
- Just (Recorder.HandledError he) -> void $ logWarn logger $ show he
- Nothing -> do
- logWarn logger $ show e
- Recorder.addEvent (recorder env) Recorder.RuntimeError
- Recorder.addEvent (recorder env) Recorder.End) $ do
- action (env {recorder = rec})
- Recorder.addEvent rec Recorder.End
+ bracket takeRecorder (\rec -> Recorder.addEvent rec Recorder.End) $ \rec -> do
+ result <- try $ action (env {recorder = rec})
+ case result of
+ Right _ -> return ()
+ Left e -> recordException e
case runStyle of
RunCount count -> replicateM_ (count * concurrency) actionThread
RunTimed time -> void $ timeout (time * 1000000) $ forever actionThread
@@ -106,6 +99,14 @@ runAction logger timeoutTime concurrency runStyle action env = do
case mtimeout of
Nothing -> void $ logError logger $ "Timed out waiting for all " ++ "threads to complete"
Just () -> return ()
+ where
+ recordException e =
+ case fromException e of
+ Just (Recorder.HandledError he) -> do
+ void $ logWarn logger $ show he
+ _ -> do
+ logWarn logger $ show e
+ Recorder.addEvent (recorder env) Recorder.RuntimeError
------------------------------------------------------------------------------
--- Generic Run Function
diff --git a/wrecker.cabal b/wrecker.cabal
index 7beb30c..39cb76e 100644
--- a/wrecker.cabal
+++ b/wrecker.cabal
@@ -1,5 +1,5 @@
name: wrecker
-version: 1.2.1.0
+version: 1.2.2.0
synopsis: An HTTP Performance Benchmarker
description:
'wrecker' is a library and executable for creating HTTP benchmarks. It is designed for