fix: refresh optional CLI Apps catalogs
maintainer edit: CLI Apps settings now treats optional catalog caches as refresh candidates without blocking the initial payload, and pending polling stops when refresh is throttled instead of running indefinitely.
This commit is contained in:
@@ -213,6 +213,8 @@ const DEFERRED_MODEL_LIST_PROVIDERS = new Set([
|
||||
"volcengine_coding_plan",
|
||||
]);
|
||||
const DEFERRED_MODEL_LIST_QUERY_MIN_LENGTH = 2;
|
||||
const CLI_APPS_REFRESH_RETRY_MS = 2_000;
|
||||
const CLI_APPS_REFRESH_MAX_RETRIES = 30;
|
||||
|
||||
const FALLBACK_TIMEZONES = [
|
||||
"UTC",
|
||||
@@ -696,13 +698,18 @@ export function SettingsView({
|
||||
if (activeSection !== "apps") return;
|
||||
let cancelled = false;
|
||||
let retry: number | null = null;
|
||||
let retryCount = 0;
|
||||
const loadCliApps = (showLoading: boolean) => {
|
||||
if (showLoading) setCliAppsLoading(true);
|
||||
fetchCliApps(token)
|
||||
.then((payload) => {
|
||||
if (cancelled) return;
|
||||
if (payload.catalog_refresh_pending) {
|
||||
retry = window.setTimeout(() => loadCliApps(false), 2000);
|
||||
if (payload.catalog_refresh_pending && retryCount < CLI_APPS_REFRESH_MAX_RETRIES) {
|
||||
retryCount += 1;
|
||||
retry = window.setTimeout(() => {
|
||||
retry = null;
|
||||
loadCliApps(false);
|
||||
}, CLI_APPS_REFRESH_RETRY_MS);
|
||||
}
|
||||
setCliApps(payload);
|
||||
setCliAppsError(null);
|
||||
|
||||
Reference in New Issue
Block a user