"git@web.lueluesay.top:chenxi/sub2api.git" did not exist on "9fd95df5cf276ab545f82591de47d8a82bd2cf89"
Unverified Commit 1727b8df authored by Wesley Liddick's avatar Wesley Liddick Committed by GitHub
Browse files

Merge pull request #1404 from DaydreamCoding/feat/antigravity-privacy-on-refresh-fail

feat(antigravity): 令牌刷新失败及创建账号时也设置隐私
parents a025a15f 46bc5ca7
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log/slog"
"net/http" "net/http"
"strings" "strings"
"time" "time"
...@@ -1587,6 +1588,18 @@ func (s *adminServiceImpl) CreateAccount(ctx context.Context, input *CreateAccou ...@@ -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 return account, nil
} }
......
...@@ -305,6 +305,7 @@ func (s *TokenRefreshService) refreshWithRetry(ctx context.Context, account *Acc ...@@ -305,6 +305,7 @@ func (s *TokenRefreshService) refreshWithRetry(ctx context.Context, account *Acc
} }
// 刷新失败但 access_token 可能仍有效,尝试设置隐私 // 刷新失败但 access_token 可能仍有效,尝试设置隐私
s.ensureOpenAIPrivacy(ctx, account) s.ensureOpenAIPrivacy(ctx, account)
s.ensureAntigravityPrivacy(ctx, account)
return err return err
} }
...@@ -334,6 +335,7 @@ func (s *TokenRefreshService) refreshWithRetry(ctx context.Context, account *Acc ...@@ -334,6 +335,7 @@ func (s *TokenRefreshService) refreshWithRetry(ctx context.Context, account *Acc
// 刷新失败但 access_token 可能仍有效,尝试设置隐私 // 刷新失败但 access_token 可能仍有效,尝试设置隐私
s.ensureOpenAIPrivacy(ctx, account) s.ensureOpenAIPrivacy(ctx, account)
s.ensureAntigravityPrivacy(ctx, account)
// 设置临时不可调度 10 分钟(不标记 error,保持 status=active 让下个刷新周期能继续尝试) // 设置临时不可调度 10 分钟(不标记 error,保持 status=active 让下个刷新周期能继续尝试)
until := time.Now().Add(tokenRefreshTempUnschedDuration) until := time.Now().Add(tokenRefreshTempUnschedDuration)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment