Improve updateAccountPeers by bypassing AM and using account directly (#1193)

Improve updateAccountPeers performance by bypassing AM and using the account directly
This commit is contained in:
Yury Gargay
2023-10-04 15:08:50 +02:00
committed by GitHub
parent 26bbc33e7a
commit 9131069d12
9 changed files with 49 additions and 77 deletions

View File

@@ -1491,9 +1491,7 @@ func (am *DefaultAccountManager) GetAccountFromToken(claims jwtclaims.Authorizat
if err := am.Store.SaveAccount(account); err != nil {
log.Errorf("failed to save account: %v", err)
} else {
if err := am.updateAccountPeers(account); err != nil {
log.Errorf("failed updating account peers while updating user %s", account.Id)
}
am.updateAccountPeers(account)
for _, g := range addNewGroups {
if group := account.GetGroup(g); group != nil {
am.storeEvent(user.Id, user.Id, account.Id, activity.GroupAddedToUser,