fix: clear race timeout after plugin loading settles
This commit is contained in:
parent
050e6a2187
commit
c2dfcadbac
@ -120,15 +120,19 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
if (pluginsEnabled) {
|
if (pluginsEnabled) {
|
||||||
const timeoutMs = pluginConfig.experimental?.plugin_load_timeout_ms ?? 10000;
|
const timeoutMs = pluginConfig.experimental?.plugin_load_timeout_ms ?? 10000;
|
||||||
try {
|
try {
|
||||||
const timeoutPromise = new Promise<never>((_, reject) =>
|
let timeoutId: ReturnType<typeof setTimeout>;
|
||||||
setTimeout(() => reject(new Error(`Plugin loading timed out after ${timeoutMs}ms`)), timeoutMs)
|
const timeoutPromise = new Promise<never>((_, reject) => {
|
||||||
);
|
timeoutId = setTimeout(
|
||||||
|
() => reject(new Error(`Plugin loading timed out after ${timeoutMs}ms`)),
|
||||||
|
timeoutMs,
|
||||||
|
);
|
||||||
|
});
|
||||||
pluginComponents = await Promise.race([
|
pluginComponents = await Promise.race([
|
||||||
loadAllPluginComponents({
|
loadAllPluginComponents({
|
||||||
enabledPluginsOverride: pluginConfig.claude_code?.plugins_override,
|
enabledPluginsOverride: pluginConfig.claude_code?.plugins_override,
|
||||||
}),
|
}),
|
||||||
timeoutPromise,
|
timeoutPromise,
|
||||||
]);
|
]).finally(() => clearTimeout(timeoutId));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||||
log("[config-handler] Plugin loading failed", { error: errorMessage });
|
log("[config-handler] Plugin loading failed", { error: errorMessage });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user