Merge pull request #1404 from DaydreamCoding/feat/antigravity-privacy-on-refresh-fail
feat(antigravity): 令牌刷新失败及创建账号时也设置隐私
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -1587,6 +1588,18 @@ func (s *adminServiceImpl) CreateAccount(ctx context.Context, input *CreateAccou
|
||||
}
|
||||
}
|
||||
|
||||
// Antigravity OAuth 账号:创建后异步设置隐私
|
||||
if account.Platform == PlatformAntigravity && account.Type == AccountTypeOAuth {
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
slog.Error("create_account_antigravity_privacy_panic", "account_id", account.ID, "recover", r)
|
||||
}
|
||||
}()
|
||||
s.EnsureAntigravityPrivacy(context.Background(), account)
|
||||
}()
|
||||
}
|
||||
|
||||
return account, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -305,6 +305,7 @@ func (s *TokenRefreshService) refreshWithRetry(ctx context.Context, account *Acc
|
||||
}
|
||||
// 刷新失败但 access_token 可能仍有效,尝试设置隐私
|
||||
s.ensureOpenAIPrivacy(ctx, account)
|
||||
s.ensureAntigravityPrivacy(ctx, account)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -334,6 +335,7 @@ func (s *TokenRefreshService) refreshWithRetry(ctx context.Context, account *Acc
|
||||
|
||||
// 刷新失败但 access_token 可能仍有效,尝试设置隐私
|
||||
s.ensureOpenAIPrivacy(ctx, account)
|
||||
s.ensureAntigravityPrivacy(ctx, account)
|
||||
|
||||
// 设置临时不可调度 10 分钟(不标记 error,保持 status=active 让下个刷新周期能继续尝试)
|
||||
until := time.Now().Add(tokenRefreshTempUnschedDuration)
|
||||
|
||||
Reference in New Issue
Block a user