Fix database transaction locking issue

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga 2024-11-20 22:45:14 +03:00
parent 6ea98f0ce7
commit 66d8bbf8e2
No known key found for this signature in database
GPG Key ID: 511EED5C928AD547

View File

@ -711,7 +711,7 @@ func (am *DefaultAccountManager) SaveOrAddUsers(ctx context.Context, accountID,
updateAccountPeers = true
}
updatedUserInfo, err := getUserInfo(ctx, am, updatedUser, accountID)
updatedUserInfo, err := am.getUserInfo(ctx, transaction, updatedUser, accountID)
if err != nil {
return fmt.Errorf("failed to get user info: %w", err)
}
@ -891,8 +891,8 @@ func handleOwnerRoleTransfer(ctx context.Context, transaction Store, initiatorUs
// getUserInfo retrieves the UserInfo for a given User and Account.
// If the AccountManager has a non-nil idpManager and the User is not a service user,
// it will attempt to look up the UserData from the cache.
func getUserInfo(ctx context.Context, am *DefaultAccountManager, user *User, accountID string) (*UserInfo, error) {
settings, err := am.Store.GetAccountSettings(ctx, LockingStrengthShare, accountID)
func (am *DefaultAccountManager) getUserInfo(ctx context.Context, transaction Store, user *User, accountID string) (*UserInfo, error) {
settings, err := transaction.GetAccountSettings(ctx, LockingStrengthShare, accountID)
if err != nil {
return nil, err
}