Skip to content

Commit

Permalink
Log global lock acquisition per user (#2039)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlsmaycon authored May 23, 2024
1 parent 6b01b00 commit 29a2d93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions management/server/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions management/server/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 29a2d93

Please sign in to comment.