chore(crontab): ldap avs synchs restricted to night hours
This commit is contained in:
parent
9992bf2b8d
commit
16f34258ba
@ -324,7 +324,7 @@ determineCrontab = execWriterT $ do
|
|||||||
, jIteration = fromInteger nextInterval
|
, jIteration = fromInteger nextInterval
|
||||||
})
|
})
|
||||||
Cron
|
Cron
|
||||||
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ nextIntervalTime
|
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ $ toTimeOfDay 23 30 0 $ utctDay nextIntervalTime
|
||||||
, cronRepeat = CronRepeatNever
|
, cronRepeat = CronRepeatNever
|
||||||
, cronRateLimit = appSynchroniseLdapUsersInterval
|
, cronRateLimit = appSynchroniseLdapUsersInterval
|
||||||
, cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appSynchroniseLdapUsersInterval nextIntervalTime
|
, cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appSynchroniseLdapUsersInterval nextIntervalTime
|
||||||
@ -337,6 +337,7 @@ determineCrontab = execWriterT $ do
|
|||||||
, Just syncWithin <- appSynchroniseAvsUsersWithin
|
, Just syncWithin <- appSynchroniseAvsUsersWithin
|
||||||
, Just cInterval <- appJobCronInterval
|
, Just cInterval <- appJobCronInterval
|
||||||
-> do
|
-> do
|
||||||
|
now <- liftIO getCurrentTime
|
||||||
nextIntervals <- getNextIntervals syncWithin appSynchroniseAvsUsersInterval cInterval
|
nextIntervals <- getNextIntervals syncWithin appSynchroniseAvsUsersInterval cInterval
|
||||||
|
|
||||||
forM_ nextIntervals $ \(nextEpoch, nextInterval, nextIntervalTime, numIntervals) -> do
|
forM_ nextIntervals $ \(nextEpoch, nextInterval, nextIntervalTime, numIntervals) -> do
|
||||||
@ -345,12 +346,12 @@ determineCrontab = execWriterT $ do
|
|||||||
{ jEpoch = fromInteger nextEpoch
|
{ jEpoch = fromInteger nextEpoch
|
||||||
, jNumIterations = fromInteger numIntervals
|
, jNumIterations = fromInteger numIntervals
|
||||||
, jIteration = fromInteger nextInterval
|
, jIteration = fromInteger nextInterval
|
||||||
, jSynchAfter = Nothing
|
, jSynchAfter = Just $ addWeeks (-1) now -- at most once per week
|
||||||
})
|
})
|
||||||
Cron
|
Cron
|
||||||
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ nextIntervalTime
|
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ $ toTimeOfDay 22 0 0 $ utctDay nextIntervalTime
|
||||||
, cronRepeat = CronRepeatNever
|
, cronRepeat = CronRepeatNever
|
||||||
, cronRateLimit = appSynchroniseLdapUsersInterval
|
, cronRateLimit = appSynchroniseAvsUsersInterval
|
||||||
, cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appSynchroniseAvsUsersInterval nextIntervalTime
|
, cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appSynchroniseAvsUsersInterval nextIntervalTime
|
||||||
}
|
}
|
||||||
| otherwise
|
| otherwise
|
||||||
@ -367,28 +368,28 @@ determineCrontab = execWriterT $ do
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
Cron
|
Cron
|
||||||
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ nextIntervalTime
|
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ $ toTimeOfDay 22 0 0 $ utctDay nextIntervalTime
|
||||||
, cronRepeat = CronRepeatNever
|
, cronRepeat = CronRepeatNever
|
||||||
, cronRateLimit = appPruneUnreferencedFilesInterval
|
, cronRateLimit = appPruneUnreferencedFilesInterval
|
||||||
, cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appPruneUnreferencedFilesInterval nextIntervalTime
|
, cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appPruneUnreferencedFilesInterval nextIntervalTime
|
||||||
}
|
}
|
||||||
|
|
||||||
whenIsJust ((,) <$> appStudyFeaturesRecacheRelevanceWithin <*> appJobCronInterval) $ \(within, cInterval) -> do
|
-- whenIsJust ((,) <$> appStudyFeaturesRecacheRelevanceWithin <*> appJobCronInterval) $ \(within, cInterval) -> do
|
||||||
nextIntervals <- getNextIntervals within appStudyFeaturesRecacheRelevanceInterval cInterval
|
-- nextIntervals <- getNextIntervals within appStudyFeaturesRecacheRelevanceInterval cInterval
|
||||||
forM_ nextIntervals $ \(nextEpoch, nextInterval, nextIntervalTime, numIntervals) -> do
|
-- forM_ nextIntervals $ \(nextEpoch, nextInterval, nextIntervalTime, numIntervals) -> do
|
||||||
tell $ HashMap.singleton
|
-- tell $ HashMap.singleton
|
||||||
(JobCtlQueue JobStudyFeaturesRecacheRelevance
|
-- (JobCtlQueue JobStudyFeaturesRecacheRelevance
|
||||||
{ jEpoch = fromInteger nextEpoch
|
-- { jEpoch = fromInteger nextEpoch
|
||||||
, jNumIterations = fromInteger numIntervals
|
-- , jNumIterations = fromInteger numIntervals
|
||||||
, jIteration = fromInteger nextInterval
|
-- , jIteration = fromInteger nextInterval
|
||||||
}
|
-- }
|
||||||
)
|
-- )
|
||||||
Cron
|
-- Cron
|
||||||
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ nextIntervalTime
|
-- { cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ toTimeOfDay 22 0 0 $ utctDay nextIntervalTime
|
||||||
, cronRepeat = CronRepeatNever
|
-- , cronRepeat = CronRepeatNever
|
||||||
, cronRateLimit = appStudyFeaturesRecacheRelevanceInterval
|
-- , cronRateLimit = appStudyFeaturesRecacheRelevanceInterval
|
||||||
, cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appStudyFeaturesRecacheRelevanceInterval nextIntervalTime
|
-- , cronNotAfter = Right . CronTimestamp . utcToLocalTimeTZ appTZ $ addUTCTime appStudyFeaturesRecacheRelevanceInterval nextIntervalTime
|
||||||
}
|
-- }
|
||||||
|
|
||||||
whenIsJust appQualificationCheckHour $ \hour -> tell $ HashMap.singleton
|
whenIsJust appQualificationCheckHour $ \hour -> tell $ HashMap.singleton
|
||||||
(JobCtlQueue JobLmsQualificationsEnqueue)
|
(JobCtlQueue JobLmsQualificationsEnqueue)
|
||||||
|
|||||||
Reference in New Issue
Block a user