fix(ldap): no more timeout for ldap synch all button
This commit is contained in:
parent
cfe2318f81
commit
f946e99da3
@ -44,7 +44,7 @@ import Data.Aeson hiding (Result(..))
|
|||||||
|
|
||||||
-- import Handler.Users.Add as Handler.Users
|
-- import Handler.Users.Add as Handler.Users
|
||||||
|
|
||||||
import qualified Data.Conduit.List as C
|
-- import qualified Data.Conduit.List as C
|
||||||
|
|
||||||
import qualified Data.HashSet as HashSet
|
import qualified Data.HashSet as HashSet
|
||||||
|
|
||||||
@ -424,7 +424,8 @@ postUsersR = do
|
|||||||
|
|
||||||
formResult allUsersRes $ \case
|
formResult allUsersRes $ \case
|
||||||
AllUsersLdapSync -> do
|
AllUsersLdapSync -> do
|
||||||
runDBJobs . runConduit $ selectSource [] [] .| C.mapM_ (queueDBJob . JobSynchroniseLdapUser . entityKey)
|
-- runDBJobs . runConduit $ selectSource [] [] .| C.mapM_ (queueDBJob . JobSynchroniseLdapUser . entityKey) -- to slow to execute directly
|
||||||
|
queueJob' JobSynchroniseLdapAll
|
||||||
addMessageI Success MsgSynchroniseLdapAllUsersQueued
|
addMessageI Success MsgSynchroniseLdapAllUsersQueued
|
||||||
redirect UsersR
|
redirect UsersR
|
||||||
AllUsersAvsSync -> do
|
AllUsersAvsSync -> do
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
module Jobs.Handler.SynchroniseLdap
|
module Jobs.Handler.SynchroniseLdap
|
||||||
( dispatchJobSynchroniseLdap, dispatchJobSynchroniseLdapUser
|
( dispatchJobSynchroniseLdap
|
||||||
|
, dispatchJobSynchroniseLdapUser
|
||||||
|
, dispatchJobSynchroniseLdapAll
|
||||||
, SynchroniseLdapException(..)
|
, SynchroniseLdapException(..)
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ dispatchJobSynchroniseLdapUser jUser = JobHandlerException $ do
|
|||||||
Just ldapPool ->
|
Just ldapPool ->
|
||||||
runDB . void . runMaybeT . handleExc $ do
|
runDB . void . runMaybeT . handleExc $ do
|
||||||
user@User{userIdent,userLdapPrimaryKey} <- MaybeT $ get jUser
|
user@User{userIdent,userLdapPrimaryKey} <- MaybeT $ get jUser
|
||||||
let upsertIdent = maybe userIdent CI.mk userLdapPrimaryKey
|
let upsertIdent = maybe userIdent CI.mk userLdapPrimaryKey
|
||||||
$logInfoS "SynchroniseLdap" [st|Synchronising #{upsertIdent}|]
|
$logInfoS "SynchroniseLdap" [st|Synchronising #{upsertIdent}|]
|
||||||
|
|
||||||
reTestAfter <- getsYesod $ view _appLdapReTestFailover
|
reTestAfter <- getsYesod $ view _appLdapReTestFailover
|
||||||
@ -62,3 +64,6 @@ dispatchJobSynchroniseLdapUser jUser = JobHandlerException $ do
|
|||||||
handleExc
|
handleExc
|
||||||
= catchMPlus (Proxy @CampusUserException)
|
= catchMPlus (Proxy @CampusUserException)
|
||||||
. catchMPlus (Proxy @CampusUserConversionException)
|
. catchMPlus (Proxy @CampusUserConversionException)
|
||||||
|
|
||||||
|
dispatchJobSynchroniseLdapAll :: JobHandler UniWorX
|
||||||
|
dispatchJobSynchroniseLdapAll = JobHandlerAtomic . runConduit $ selectSource [] [] .| C.mapM_ (queueDBJob . JobSynchroniseLdapUser . entityKey)
|
||||||
@ -97,6 +97,7 @@ data Job
|
|||||||
, jIteration :: Natural
|
, jIteration :: Natural
|
||||||
}
|
}
|
||||||
| JobSynchroniseLdapUser { jUser :: UserId }
|
| JobSynchroniseLdapUser { jUser :: UserId }
|
||||||
|
| JobSynchroniseLdapAll
|
||||||
| JobSynchroniseAvs { jNumIterations
|
| JobSynchroniseAvs { jNumIterations
|
||||||
, jEpoch
|
, jEpoch
|
||||||
, jIteration :: Natural
|
, jIteration :: Natural
|
||||||
@ -350,6 +351,7 @@ jobNoQueueSame = \case
|
|||||||
JobDeleteTransactionLogIPs{} -> Just JobNoQueueSame
|
JobDeleteTransactionLogIPs{} -> Just JobNoQueueSame
|
||||||
JobSynchroniseLdap{} -> Just JobNoQueueSame
|
JobSynchroniseLdap{} -> Just JobNoQueueSame
|
||||||
JobSynchroniseLdapUser{} -> Just JobNoQueueSame
|
JobSynchroniseLdapUser{} -> Just JobNoQueueSame
|
||||||
|
JobSynchroniseLdapAll{} -> Just JobNoQueueSameTag
|
||||||
JobSynchroniseAvs{} -> Just JobNoQueueSame
|
JobSynchroniseAvs{} -> Just JobNoQueueSame
|
||||||
-- JobSynchroniseAvsUser{} -> Just JobNoQueueSame
|
-- JobSynchroniseAvsUser{} -> Just JobNoQueueSame
|
||||||
-- JobSynchroniseAvsId{} -> Just JobNoQueueSame
|
-- JobSynchroniseAvsId{} -> Just JobNoQueueSame
|
||||||
|
|||||||
Reference in New Issue
Block a user