[management] Increment network serial on peer update (#5051)

Increment the serial on peer update and prevent double serial increments and account updates when updating a user while there are peers set to expire
This commit is contained in:
Bethuel Mmbaga
2026-01-07 14:59:49 +03:00
committed by GitHub
parent d35b7d675c
commit 20d6beff1b
2 changed files with 5 additions and 3 deletions

View File

@@ -269,6 +269,10 @@ func (am *DefaultAccountManager) UpdatePeer(ctx context.Context, accountID, user
inactivityExpirationChanged = true
}
if err = transaction.IncrementNetworkSerial(ctx, accountID); err != nil {
return fmt.Errorf("failed to increment network serial: %w", err)
}
return transaction.SavePeer(ctx, accountID, peer)
})
if err != nil {

View File

@@ -577,9 +577,7 @@ func (am *DefaultAccountManager) SaveOrAddUsers(ctx context.Context, accountID,
log.WithContext(ctx).Errorf("failed update expired peers: %s", err)
return nil, err
}
}
if updateAccountPeers {
} else if updateAccountPeers {
if err = am.Store.IncrementNetworkSerial(ctx, accountID); err != nil {
return nil, fmt.Errorf("failed to increment network serial: %w", err)
}