fix(scripts): clear RPC RTT send failure timers · openclaw/openclaw@118f3f3
vincentkoc
·
2026-06-20
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -720,18 +720,19 @@ export function createGatewayClient({ WebSocket, openTimeoutMs = 8_000, url }) {
|
720 | 720 | reject(new Error(`timeout waiting for ${method}`)); |
721 | 721 | }, timeoutMs); |
722 | 722 | pending.set(id, { resolve, reject, timeout }); |
723 | | -ws.send(JSON.stringify({ type: "req", id, method, params }), (error) => { |
| 723 | +const rejectSendFailure = (error) => { |
724 | 724 | if (!error) { |
725 | 725 | return; |
726 | 726 | } |
727 | | -const waiter = pending.get(id); |
728 | | -if (!waiter) { |
729 | | -return; |
730 | | -} |
731 | 727 | pending.delete(id); |
732 | | -clearTimeout(waiter.timeout); |
733 | | -waiter.reject(error instanceof Error ? error : new Error(String(error))); |
734 | | -}); |
| 728 | +clearTimeout(timeout); |
| 729 | +reject(error instanceof Error ? error : new Error(String(error))); |
| 730 | +}; |
| 731 | +try { |
| 732 | +ws.send(JSON.stringify({ type: "req", id, method, params }), rejectSendFailure); |
| 733 | +} catch (error) { |
| 734 | +rejectSendFailure(error); |
| 735 | +} |
735 | 736 | }); |
736 | 737 | const close = () => { |
737 | 738 | rejectPending(new Error("gateway websocket client closed")); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。