fix(avs): attempt to fix avs background jobs

This commit is contained in:
Steffen Jost 2023-06-23 13:16:09 +00:00
parent 55d2dfcef3
commit bbaa42eefa
3 changed files with 17 additions and 2 deletions

View File

@ -222,6 +222,8 @@ postAdminTestR = do
usrCryptoFileName <- maybeM (return "no-user_id") (fmap toPathPiece . mkCryptoFilnameUser) maybeAuthId
usrCryptoUUID <- maybeM (return "no-user_id") (fmap toPathPiece . mkCryptoUUIDUser) maybeAuthId
UniWorX{ appSettings' = AppSettings{..} } <- getYesod
let locallyDefinedPageHeading = [whamlet|Admin TestPage for Uni2work|]
siteLayout locallyDefinedPageHeading $ do
-- defaultLayout $ do
@ -311,6 +313,18 @@ postAdminTestR = do
|]
i18n $ MsgPrintDebugForStupid "DebugForStupid"
[whamlet|
<section>
<h2> Some Active App Settings
<dl .deflist>
<dt .deflist__dt> appJobCronInterval
<dd .deflist__dd>#{tshow appJobCronInterval}
<dt .deflist__dt> appSynchroniseLdapUsersWithin
<dd .deflist__dd>#{tshow appSynchroniseLdapUsersWithin}
<dt .deflist__dt> appSynchroniseAvsUsersWithin
<dd .deflist__dd>#{tshow appSynchroniseAvsUsersWithin}
|]

View File

@ -338,6 +338,7 @@ determineCrontab = execWriterT $ do
, Just cInterval <- appJobCronInterval
-> do
now <- liftIO getCurrentTime
let nowaday = utctDay now
nextIntervals <- getNextIntervals syncWithin appSynchroniseAvsUsersInterval cInterval
forM_ nextIntervals $ \(nextEpoch, nextInterval, nextIntervalTime, numIntervals) -> do
@ -346,7 +347,7 @@ determineCrontab = execWriterT $ do
{ jEpoch = fromInteger nextEpoch
, jNumIterations = fromInteger numIntervals
, jIteration = fromInteger nextInterval
, jSynchAfter = Just $ addWeeks (-1) now -- at most once per week
, jSynchAfter = Just $ toMidnight $ addDays (-7) nowaday -- at most once per week
})
Cron
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ $ toTimeOfDay 22 0 0 $ utctDay nextIntervalTime

View File

@ -336,7 +336,7 @@ jobNoQueueSame = \case
JobPruneInvitations{} -> Just JobNoQueueSame
JobDeleteTransactionLogIPs{} -> Just JobNoQueueSame
JobSynchroniseLdapUser{} -> Just JobNoQueueSame
JobSynchroniseAvsUser{} -> Just JobNoQueueSame
JobSynchroniseAvsUser{} -> Just JobNoQueueSameTag
JobSynchroniseAvsId{} -> Just JobNoQueueSame
JobChangeUserDisplayEmail{} -> Just JobNoQueueSame
JobPruneSessionFiles{} -> Just JobNoQueueSameTag