@@ -168,7 +168,7 @@ logCallbackErrors jid msg action = catchAny action $ \e -> log LevelError $ LogT
169instance HasJobRunner RunnerM where
169instance HasJobRunner RunnerM where
170 getPollingInterval = cfgPollingInterval . envConfig <$> ask
170 getPollingInterval = cfgPollingInterval . envConfig <$> ask
171− onJobFailed = do { env <- ask; pure (cfgOnJobFailed (envConfig env)) }
171+ onJobFailed = cfgOnJobFailed . envConfig <$> ask
172 onJobSuccess job = do
172 onJobSuccess job = do
173 fn <- cfgOnJobSuccess . envConfig <$> ask
173 fn <- cfgOnJobSuccess . envConfig <$> ask
174 logCallbackErrors (jobId job) "onJobSuccess" $ liftIO $ fn job
174 logCallbackErrors (jobId job) "onJobSuccess" $ liftIO $ fn job
@@ -338,7 +338,7 @@ runJobNowIO conn tname jid = do
338-- and somehow send an uninterruptibleCancel to that thread.
338-- and somehow send an uninterruptibleCancel to that thread.
339unlockJobIO :: Connection -> TableName -> JobId -> IO (Maybe Job)
339unlockJobIO :: Connection -> TableName -> JobId -> IO (Maybe Job)
340unlockJobIO conn tname jid = do
340unlockJobIO conn tname jid = do
341− fmap listToMaybe $ PGS.query conn q (tname, Retry, jid, In [Locked])
341+ listToMaybe <$> PGS.query conn q (tname, Retry, jid, In [Locked])
343 q = "update ? set status=?, run_at=now(), locked_at=null, locked_by=null where id=? and status in ? returning " <> concatJobDbColumns
343 q = "update ? set status=?, run_at=now(), locked_at=null, locked_by=null where id=? and status in ? returning " <> concatJobDbColumns
@@ -351,7 +351,7 @@ updateJobHelper :: TableName
351 -> (Status, [Status], Maybe UTCTime, JobId)
351 -> (Status, [Status], Maybe UTCTime, JobId)
352 -> IO (Maybe Job)
352 -> IO (Maybe Job)
353updateJobHelper tname conn (newStatus, existingStates, mRunAt, jid) =
353updateJobHelper tname conn (newStatus, existingStates, mRunAt, jid) =
354− fmap listToMaybe $ PGS.query conn q (tname, newStatus, runAt, jid, PGS.In existingStates)
354+ listToMaybe <$> PGS.query conn q (tname, newStatus, runAt, jid, PGS.In existingStates)
356 q = "update ? set attempts=0, status=?, run_at=? where id=? and status in ? returning " <> concatJobDbColumns
356 q = "update ? set attempts=0, status=?, run_at=? where id=? and status in ? returning " <> concatJobDbColumns
357 runAt = case mRunAt of
357 runAt = case mRunAt of
@@ -714,5 +714,5 @@ fetchAllJobRunners :: (MonadIO m)
714 => UIConfig
714 => UIConfig
715 -> m [JobRunnerName]
715 -> m [JobRunnerName]
716fetchAllJobRunners UIConfig{uicfgTableName, uicfgDbPool} = liftIO $ withResource uicfgDbPool $ \conn -> do
716fetchAllJobRunners UIConfig{uicfgTableName, uicfgDbPool} = liftIO $ withResource uicfgDbPool $ \conn -> do
717− fmap (mapMaybe fromOnly) $ PGS.query conn "select distinct locked_by from ?" (Only uicfgTableName)
717+ mapMaybe fromOnly <$> PGS.query conn "select distinct locked_by from ?" (Only uicfgTableName)