on master help sign in
Follow hlint suggestion: use join.
d1a1c86Phil de Joux
.hlint.yaml−1
@@ -8,7 +8,6 @@
8- ignore: {name: "Replace case with fromMaybe"} # 2 hints
8- ignore: {name: "Replace case with fromMaybe"} # 2 hints
9- ignore: {name: "Use <$>"} # 6 hints
9- ignore: {name: "Use <$>"} # 6 hints
10- ignore: {name: "Use asks"} # 12 hints
10- ignore: {name: "Use asks"} # 12 hints
11−- ignore: {name: "Use join"} # 1 hint
12- ignore: {name: "Use lambda-case"} # 5 hints
11- ignore: {name: "Use lambda-case"} # 5 hints
13- ignore: {name: "Use list literal pattern"} # 2 hints
12- ignore: {name: "Use list literal pattern"} # 2 hints
14- ignore: {name: "Use newtype instead of data"} # 1 hint
13- ignore: {name: "Use newtype instead of data"} # 1 hint
src/OddJobs/Job.hs+14−14
@@ -537,20 +537,20 @@ jobPoller = do
537 -- If we can't run any jobs ATM, relax and wait for resources to free up
537 -- If we can't run any jobs ATM, relax and wait for resources to free up
538 delayAction
538 delayAction
539 True -> do
539 True -> do
540+ join
540− nextAction <- mask_ $ do
541+ (mask_ $ do
541− log LevelDebug $ LogText $ toS $ "[" <> processName <> "] Polling the job queue.."
542+ log LevelDebug $ LogText $ toS $ "[" <> processName <> "] Polling the job queue.."
542− r <- liftIO $ jobPollingIO pollerDbConn processName tname lockTimeout
543+ r <- liftIO $ jobPollingIO pollerDbConn processName tname lockTimeout
543− case r of
544+ case r of
544− -- When we don't have any jobs to run, we can relax a bit...
545+ -- When we don't have any jobs to run, we can relax a bit...
545− [] -> pure delayAction
546+ [] -> pure delayAction
546−
547+
547− -- When we find a job to run, fork and try to find the next job without any delay...
548+ -- When we find a job to run, fork and try to find the next job without any delay...
548− [Only (jid :: JobId)] -> do
549+ [Only (jid :: JobId)] -> do
549− void $ async $ runJob jid
550+ void $ async $ runJob jid
550− pure noDelayAction
551+ pure noDelayAction
551−
552+
552− x -> error $ "WTF just happened? I was supposed to get only a single row, but got: " ++ (show x)
553+ x -> error $ "WTF just happened? I was supposed to get only a single row, but got: " ++ (show x))
553− nextAction
554 where
554 where
555 delayAction = delaySeconds =<< getPollingInterval
555 delayAction = delaySeconds =<< getPollingInterval
556 noDelayAction = pure ()
556 noDelayAction = pure ()