CronNotScheduled
This commit is contained in:
parent
d6e0e9f7ca
commit
c3332b57ef
@ -179,6 +179,9 @@ nextCronMatch tz mPrev now c@Cron{..}
|
|||||||
-> MatchAsap
|
-> MatchAsap
|
||||||
| otherwise
|
| otherwise
|
||||||
-> MatchAt $ addUTCTime cronMinInterval prevT
|
-> MatchAt $ addUTCTime cronMinInterval prevT
|
||||||
|
CronNotScheduled
|
||||||
|
| CronTimestamp{ cronTimestamp = localTimeToUTCTZ tz -> ts } <- cronNext
|
||||||
|
, now <= ts -> MatchAt ts
|
||||||
cronNext -> execRef (addUTCTime cronMinInterval prevT) True cronNext
|
cronNext -> execRef (addUTCTime cronMinInterval prevT) True cronNext
|
||||||
where
|
where
|
||||||
execRef ref wasExecd cronAbsolute = case cronAbsolute of
|
execRef ref wasExecd cronAbsolute = case cronAbsolute of
|
||||||
@ -203,3 +206,4 @@ nextCronMatch tz mPrev now c@Cron{..}
|
|||||||
localDay <- maybeToList $ fromGregorianValid (fromIntegral cronYear) (fromIntegral cronMonth) (fromIntegral cronDayOfMonth)
|
localDay <- maybeToList $ fromGregorianValid (fromIntegral cronYear) (fromIntegral cronMonth) (fromIntegral cronDayOfMonth)
|
||||||
let localTimeOfDay = TimeOfDay (fromIntegral cronHour) (fromIntegral cronMinute) (fromIntegral cronSecond)
|
let localTimeOfDay = TimeOfDay (fromIntegral cronHour) (fromIntegral cronMinute) (fromIntegral cronSecond)
|
||||||
return $ localTimeToUTCTZ tz LocalTime{..}
|
return $ localTimeToUTCTZ tz LocalTime{..}
|
||||||
|
CronNotScheduled -> MatchNone
|
||||||
|
|||||||
@ -43,6 +43,7 @@ data CronAbsolute
|
|||||||
, cronDayOfWeek
|
, cronDayOfWeek
|
||||||
, cronHour, cronMinute, cronSecond :: CronMatch
|
, cronHour, cronMinute, cronSecond :: CronMatch
|
||||||
}
|
}
|
||||||
|
| CronNotScheduled
|
||||||
deriving (Eq, Show, Read)
|
deriving (Eq, Show, Read)
|
||||||
|
|
||||||
makeLenses_ ''CronAbsolute
|
makeLenses_ ''CronAbsolute
|
||||||
|
|||||||
10
src/Jobs.hs
10
src/Jobs.hs
@ -384,13 +384,19 @@ determineCrontab = (\ct -> ct <$ pruneLastExecs ct) <=< execWriterT $ do
|
|||||||
(JobCtlQueue $ JobQueueNotification NotificationSheetActive{..})
|
(JobCtlQueue $ JobQueueNotification NotificationSheetActive{..})
|
||||||
Cron
|
Cron
|
||||||
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ sheetActiveFrom
|
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ sheetActiveFrom
|
||||||
, cronRepeat = Nothing
|
, cronRepeat = Just CronPeriod
|
||||||
|
{ cronMinInterval = 3600
|
||||||
|
, cronNext = CronNotScheduled -- Allow repetition of the notification (if something changes), but wait at least an hour
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tell $ HashMap.singleton
|
tell $ HashMap.singleton
|
||||||
(JobCtlQueue $ JobQueueNotification NotificationSheetInactive{..})
|
(JobCtlQueue $ JobQueueNotification NotificationSheetInactive{..})
|
||||||
Cron
|
Cron
|
||||||
{ cronInitial = CronTimestamp . utcToLocalTimeTZ appTZ . max sheetActiveFrom $ addUTCTime (-nominalDay) sheetActiveTo
|
{ cronInitial = CronTimestamp . utcToLocalTimeTZ appTZ . max sheetActiveFrom $ addUTCTime (-nominalDay) sheetActiveTo
|
||||||
, cronRepeat = Nothing
|
, cronRepeat = Just CronPeriod
|
||||||
|
{ cronMinInterval = 3600
|
||||||
|
, cronNext = CronNotScheduled
|
||||||
|
}
|
||||||
}
|
}
|
||||||
runConduit $ transPipe lift (selectSource [] []) .| C.mapM_ sheetJobs
|
runConduit $ transPipe lift (selectSource [] []) .| C.mapM_ sheetJobs
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user