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