feat(jobs): queue by jobctl priority
This commit is contained in:
parent
8873aed765
commit
a27a553e0a
@ -334,7 +334,7 @@ execCrontab = do
|
||||
lastTimes <- State.get
|
||||
now <- liftIO getCurrentTime
|
||||
let currentCrontab' = sortOn cmpProj . flip map (HashMap.toList currentCrontab) $ \(job, cron) -> (job, getMax <$> HashMap.lookup job lastTimes, ) $ nextCronMatch appTZ (getMax <$> HashMap.lookup job lastTimes) (debouncingAcc settings job) now cron
|
||||
where cmpProj (j, lT, qT) = (qT, lT, j)
|
||||
where cmpProj (j, lT, qT) = (qT, Down $ prioritiseJob j, lT, j)
|
||||
crontabTVar <- asks jobCurrentCrontab
|
||||
atomically . writeTVar crontabTVar $ Just (now, currentCrontab')
|
||||
$logDebugS "Crontab" . intercalate "\n" $ "Current crontab:" : map tshow currentCrontab'
|
||||
@ -395,6 +395,7 @@ execCrontab = do
|
||||
where
|
||||
t = nextCronMatch appTZ (getMax <$> HashMap.lookup jobCtl lastTimes) (debouncingAcc settings jobCtl) now cron
|
||||
cmpProj (j, qT) = ( qT
|
||||
, Down $ prioritiseJob j
|
||||
, getMax <$> HashMap.lookup j lastTimes
|
||||
, j
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user