Increase chat send RPC timeout to 120s for high-latency networks (#311)
This commit is contained in:
committed by
GitHub
Unverified
parent
c5058908af
commit
0901d9912a
@@ -612,8 +612,8 @@ function registerGatewayHandlers(
|
|||||||
|
|
||||||
logger.info(`[chat:sendWithMedia] Sending: message="${message.substring(0, 100)}", attachments=${imageAttachments.length}, fileRefs=${fileReferences.length}`);
|
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)
|
// Longer timeout for chat sends to tolerate high-latency networks (avoids connect error)
|
||||||
const timeoutMs = imageAttachments.length > 0 ? 120000 : 30000;
|
const timeoutMs = 120000;
|
||||||
const result = await gatewayManager.rpc('chat.send', rpcParams, timeoutMs);
|
const result = await gatewayManager.rpc('chat.send', rpcParams, timeoutMs);
|
||||||
logger.info(`[chat:sendWithMedia] RPC result: ${JSON.stringify(result)}`);
|
logger.info(`[chat:sendWithMedia] RPC result: ${JSON.stringify(result)}`);
|
||||||
return { success: true, result };
|
return { success: true, result };
|
||||||
|
|||||||
@@ -1421,6 +1421,9 @@ export const useChatStore = create<ChatState>((set, get) => ({
|
|||||||
|
|
||||||
let result: { success: boolean; result?: { runId?: string }; error?: string };
|
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) {
|
if (hasMedia) {
|
||||||
result = await window.electron.ipcRenderer.invoke(
|
result = await window.electron.ipcRenderer.invoke(
|
||||||
'chat:sendWithMedia',
|
'chat:sendWithMedia',
|
||||||
@@ -1446,6 +1449,7 @@ export const useChatStore = create<ChatState>((set, get) => ({
|
|||||||
deliver: false,
|
deliver: false,
|
||||||
idempotencyKey,
|
idempotencyKey,
|
||||||
},
|
},
|
||||||
|
CHAT_SEND_TIMEOUT_MS,
|
||||||
) as { success: boolean; result?: { runId?: string }; error?: string };
|
) as { success: boolean; result?: { runId?: string }; error?: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user