Skip to content

Commit d10d285

Browse files
authored
Merge pull request #119 from caigee-cmd/codex/fix-account-load-deadline
fix: avoid account credential timeout on console load
2 parents 354ba73 + cd2fe70 commit d10d285

7 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ Write each change in both `### English` and `### 中文` under `## Unreleased`.
77

88
### English
99

10+
- Avoid refreshing every account during console initialization, preventing credential payload timeouts when the account list is large
11+
1012
### 中文
1113

14+
- 控制台初始化不再刷新全部账号,账号较多时不会因排队读取 credential payload 而超时
1215
## 0.3.5 - 2026-09-08
1316

1417
### English

‎frontend/src/hooks/useOverview.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function OverviewProvider({ children }: { children: ReactNode }) {
5959
setError(null)
6060
return
6161
}
62-
void refresh().catch(() => undefined)
62+
void refresh(undefined, { refreshQuota: false }).catch(() => undefined)
6363
}, [apiKey, refresh])
6464

6565
const value = useMemo(

‎internal/api/accounts.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ func (s *Server) handleProviders(w http.ResponseWriter, r *http.Request) {
2424
func (s *Server) handleAccounts(w http.ResponseWriter, r *http.Request) {
2525
switch r.Method {
2626
case http.MethodGet:
27-
if r.URL.Query().Get("refresh") != "0" {
28-
_ = s.manager.RefreshAll(r.Context(), r.URL.Query().Get("refresh") == "1")
27+
if r.URL.Query().Get("refresh") == "1" {
28+
_ = s.manager.RefreshAll(r.Context(), true)
2929
}
3030
items, err := s.manager.Accounts(r.Context())
3131
if err != nil {

‎internal/api/server.go‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,11 @@ func (s *Server) handleHealth(w http.ResponseWriter, r *http.Request) {
299299
}
300300

301301
func (s *Server) handleOverview(w http.ResponseWriter, r *http.Request) {
302-
refreshCtx, refreshCancel := context.WithTimeout(context.Background(), 5*time.Second)
303-
_ = s.manager.RefreshAll(refreshCtx, r.URL.Query().Get("refresh") == "1")
304-
refreshCancel()
302+
if r.URL.Query().Get("refresh") == "1" {
303+
refreshCtx, refreshCancel := context.WithTimeout(context.Background(), 5*time.Second)
304+
_ = s.manager.RefreshAll(refreshCtx, true)
305+
refreshCancel()
306+
}
305307
accountViews, err := s.manager.Accounts(r.Context())
306308
if err != nil {
307309
writeErr(w, http.StatusInternalServerError, "account_list_failed", err.Error())

internal/webui/static/assets/TrafficChart-C1576xSB.js renamed to internal/webui/static/assets/TrafficChart-CuC78gV4.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/webui/static/assets/index-BYdP7vBD.js renamed to internal/webui/static/assets/index-DujGA_7u.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎internal/webui/static/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<link rel="preconnect" href="https://fonts.googleapis.com" />
2323
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
2424
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Outfit:wght@400;500;600;700&display=swap" rel="stylesheet" />
25-
<script type="module" crossorigin src="/assets/index-BYdP7vBD.js"></script>
25+
<script type="module" crossorigin src="/assets/index-DujGA_7u.js"></script>
2626
<link rel="stylesheet" crossorigin href="/assets/index-LfAEBqQI.css">
2727
</head>
2828
<body>

0 commit comments

Comments
 (0)