fix(account): preserve runtime state during credentials-only updates

This commit is contained in:
Wang Lvyuan
2026-03-23 03:49:28 +08:00
parent bda7c39e55
commit ad7c10727a
12 changed files with 195 additions and 37 deletions

View File

@@ -280,8 +280,7 @@ func (s *TokenRefreshService) refreshWithRetry(ctx context.Context, account *Acc
newCredentials, err = refresher.Refresh(ctx, account)
if newCredentials != nil {
newCredentials["_token_version"] = time.Now().UnixMilli()
account.Credentials = newCredentials
if saveErr := s.accountRepo.Update(ctx, account); saveErr != nil {
if saveErr := persistAccountCredentials(ctx, s.accountRepo, account, newCredentials); saveErr != nil {
return fmt.Errorf("failed to save credentials: %w", saveErr)
}
}