From 0901d9912a842aeb7c48da2a25ca3c686ced5519 Mon Sep 17 00:00:00 2001 From: paisley <8197966+su8su@users.noreply.github.com> Date: Thu, 5 Mar 2026 15:49:36 +0800 Subject: [PATCH] Increase chat send RPC timeout to 120s for high-latency networks (#311) --- electron/main/ipc-handlers.ts | 4 ++-- src/stores/chat.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/electron/main/ipc-handlers.ts b/electron/main/ipc-handlers.ts index 8722fa16f..424e94e08 100644 --- a/electron/main/ipc-handlers.ts +++ b/electron/main/ipc-handlers.ts @@ -612,8 +612,8 @@ function registerGatewayHandlers( logger.info(`[chat:sendWithMedia] Sending: message="${message.substring(0, 100)}", attachments=${imageAttachments.length}, fileRefs=${fileReferences.length}`); - // Use a longer timeout when images are present (120s vs default 30s) - const timeoutMs = imageAttachments.length > 0 ? 120000 : 30000; + // Longer timeout for chat sends to tolerate high-latency networks (avoids connect error) + const timeoutMs = 120000; const result = await gatewayManager.rpc('chat.send', rpcParams, timeoutMs); logger.info(`[chat:sendWithMedia] RPC result: ${JSON.stringify(result)}`); return { success: true, result }; diff --git a/src/stores/chat.ts b/src/stores/chat.ts index 280d8eeed..78b9dfd54 100644 --- a/src/stores/chat.ts +++ b/src/stores/chat.ts @@ -1421,6 +1421,9 @@ export const useChatStore = create((set, get) => ({ let result: { success: boolean; result?: { runId?: string }; error?: string }; + // Longer timeout for chat sends to tolerate high-latency networks (avoids connect error) + const CHAT_SEND_TIMEOUT_MS = 120_000; + if (hasMedia) { result = await window.electron.ipcRenderer.invoke( 'chat:sendWithMedia', @@ -1446,6 +1449,7 @@ export const useChatStore = create((set, get) => ({ deliver: false, idempotencyKey, }, + CHAT_SEND_TIMEOUT_MS, ) as { success: boolean; result?: { runId?: string }; error?: string }; }