fix(plugins): align management request timeouts (#294)

Use a shared 180-second timeout for management route HTTP calls and the page bridge while keeping the backend RPC limit at 120 seconds. Fix the existing Vue attribute-order lint warning.

Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-09-26 19:11:01 +08:00
committed by GitHub
co-authored by Zyy Codex
parent ca90f2b586
commit eb23a0fb3b
3 changed files with 8 additions and 3 deletions
@@ -2,6 +2,9 @@ import type { RequestConfig, RequestOptions } from '../request'
import { API_BASE_URL } from '../constants'
import request, { requestRaw } from '../request'
// 管理路由可能执行长任务,HTTP 与页面桥使用同一等待上限。
export const PLUGIN_MANAGEMENT_TIMEOUT_MS = 180_000
const MAXIMUM_MANAGEMENT_BODY_BYTES = 1024 * 1024
export interface PluginManagementTarget {
@@ -90,6 +93,7 @@ export function callPluginManagementRoute(
method: call.method,
data: call.body?.byteLength ? call.body : undefined,
headers: call.contentType ? { 'Content-Type': call.contentType } : undefined,
timeout: PLUGIN_MANAGEMENT_TIMEOUT_MS,
...options,
})
}
@@ -57,7 +57,7 @@ const detailsId = useId()
<BaseTag v-else-if="!isCurrent && uses.length" size="sm">
历史配置
</BaseTag>
<dl :id="detailsId" v-show="detailsOpen" class="m-0 grid min-w-0 grid-cols-1 gap-x-8 gap-y-4 text-cp-xs text-cp-text-secondary sm:grid-cols-2" :class="!isCurrent ? 'order-last w-full pt-2' : undefined">
<dl v-show="detailsOpen" :id="detailsId" class="m-0 grid min-w-0 grid-cols-1 gap-x-8 gap-y-4 text-cp-xs text-cp-text-secondary sm:grid-cols-2" :class="!isCurrent ? 'order-last w-full pt-2' : undefined">
<div class="grid min-w-0 content-start gap-1">
<dt class="text-cp-sm font-emphasis text-cp-text">
{{ sourceLabel(artifact.source) }}
@@ -6,7 +6,8 @@ import type {
import { THEME_TOKEN_NAMES } from '@codex-proxy/ui/theme'
import { generate, parse, walk } from 'css-tree'
import { getPluginManagementResource } from '@/api'
import { getPluginManagementResource, PLUGIN_MANAGEMENT_TIMEOUT_MS } from '@/api'
import { API_TIMEOUT_MS } from '@/api/constants'
export const PLUGIN_MANAGEMENT_BRIDGE = 'codex-proxy-plugin-management'
export const PLUGIN_MANAGEMENT_BRIDGE_VERSION = 2
@@ -543,7 +544,7 @@ function createBridgeScript(input: {
const timer = window.setTimeout(() => {
pending.delete(id);
reject(new Error('插件管理请求超时'));
}, 30000);
}, kind === 'request' ? ${PLUGIN_MANAGEMENT_TIMEOUT_MS} : ${API_TIMEOUT_MS});
pending.set(id, { resolve, reject, timer });
post(kind, id, payload, transfer);
});