chore(avs): make backround avs updates more robust

This commit is contained in:
Steffen Jost 2023-06-06 13:15:33 +00:00
parent cc465fad16
commit 7e7bd993a1
4 changed files with 15 additions and 5 deletions

View File

@ -91,8 +91,9 @@ BtnResetTokens: Authorisierungs-Tokens invalidieren
TokensLastReset: Tokens zuletzt invalidiert
ProfileNever: Nie
ProfileLastLdapSynchronisation: Letzte LDAP-Synchronisation
ProfileLdapPrimaryKey: LDAP-Primärschlüssel
ProfileLastLdapSynchronisation: Letzte LDAP-Synchronisation
ProfileLastAvsSynchronisation: Letzte AVS-Synchronisation
NotificationSettingsUpdate: Benachrichtigungs-Einstellungen erfolgreich gespeichert
NotificationSettingsHeading displayName@Text: Benachrichtigungs-Einstellungen für #{displayName}

View File

@ -91,8 +91,9 @@ BtnResetTokens: Invalidate tokens
TokensLastReset: Tokens last reset
ProfileNever: Never
ProfileLastLdapSynchronisation: Last LDAP synchronisation
ProfileLdapPrimaryKey: LDAP primary key
ProfileLastLdapSynchronisation: Last LDAP synchronisation
ProfileLastAvsSynchronisation: Last AVS synchronisation
NotificationSettingsUpdate: Successfully updated notification settings
NotificationSettingsHeading displayName: Notification settings for #{displayName}

View File

@ -15,7 +15,6 @@ import Jobs.Queue
import Handler.Utils.Avs
-- TODO: JobSynchroniseAllAvs is not yet scheduled in Crontab
dispatchJobSynchroniseAvs :: Natural -> Natural -> Natural -> Maybe UTCTime -> JobHandler UniWorX
dispatchJobSynchroniseAvs numIterations epoch iteration pause
= JobHandlerAtomic . runConduit $
@ -43,7 +42,12 @@ workJobSynchroniseAvs eauid pause = JobHandlerException $ do
Nothing -> return () -- do not create new newers in this background job, only update existing
Just Entity{entityVal=UserAvs{..}}
| maybe False (userAvsLastSynch >=) pause -> return () -- we just updated this one within the given limit
| otherwise -> void $ upsertAvsUserById userAvsPersonId -- updates UserAvsLAstSynch
| otherwise -> catch (void $ upsertAvsUserById userAvsPersonId) -- updates UserAvsLastSynch
(\case
AvsInterfaceUnavailable -> return () -- ignore and retry later
AvsUserUnknownByAvs _ -> return () -- ignore for users no longer listed in AVS
otherExc -> throwM otherExc
)
dispatchJobSynchroniseAvsId :: AvsPersonId -> Maybe UTCTime -> JobHandler UniWorX
dispatchJobSynchroniseAvsId = workJobSynchroniseAvs . Left

View File

@ -18,8 +18,12 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later
<dt .deflist__dt>
_{MsgAvsPersonNo}
^{messageTooltip tooltipAvsPersNo}
<dd .deflist__dd .ldap-primary-key>
#{view _userAvsNoPerson avs}
<dt .deflist__dt>
_{MsgProfileLastAvsSynchronisation}
<dd .deflist__dd>
#{view _userAvsNoPerson avs}
^{formatTimeW SelFormatDateTime (view _userAvsLastSynch avs)}
<dt .deflist__dt>
_{MsgNameSet}
<dd .deflist__dd>