From 29a2d93873e72ece9db854ca27c586bc954b5525 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Thu, 23 May 2024 17:09:58 +0200 Subject: [PATCH] Log global lock acquisition per user (#2039) --- management/server/account.go | 2 ++ management/server/user.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/management/server/account.go b/management/server/account.go index 132dbc73474..86e429bb2e1 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -1788,8 +1788,10 @@ func (am *DefaultAccountManager) getAccountWithAuthorizationClaims(claims jwtcla } } + start := time.Now() unlock := am.Store.AcquireGlobalLock() defer unlock() + log.Debugf("Acquired global lock in %s for user %s", time.Since(start), claims.UserId) // We checked if the domain has a primary account already domainAccount, err := am.Store.GetAccountByPrivateDomain(claims.Domain) diff --git a/management/server/user.go b/management/server/user.go index 6d187928596..2be73fa0762 100644 --- a/management/server/user.go +++ b/management/server/user.go @@ -910,8 +910,10 @@ func (am *DefaultAccountManager) SaveOrAddUser(accountID, initiatorUserID string // GetOrCreateAccountByUser returns an existing account for a given user id or creates a new one if doesn't exist func (am *DefaultAccountManager) GetOrCreateAccountByUser(userID, domain string) (*Account, error) { + start := time.Now() unlock := am.Store.AcquireGlobalLock() defer unlock() + log.Debugf("Acquired global lock in %s for user %s", time.Since(start), userID) lowerDomain := strings.ToLower(domain)