test(ci): stabilize tool search gateway timeout helper · openclaw/openclaw@582aa1c
steipete
·
2026-05-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,6 +3,7 @@ import net from "node:net";
|
3 | 3 | import os from "node:os"; |
4 | 4 | import path from "node:path"; |
5 | 5 | import process from "node:process"; |
| 6 | +import { clearTimeout as clearNodeTimeout, setTimeout as setNodeTimeout } from "node:timers"; |
6 | 7 | import { pathToFileURL } from "node:url"; |
7 | 8 | import { startQaMockOpenAiServer } from "../extensions/qa-lab/src/providers/mock-openai/server.js"; |
8 | 9 | import { stageQaMockAuthProfiles } from "../extensions/qa-lab/src/providers/shared/mock-auth.js"; |
@@ -148,9 +149,9 @@ export async function fetchJson(
|
148 | 149 | const maxBodyBytes = Math.max(1, options.maxBodyBytes ?? DEFAULT_FETCH_BODY_MAX_BYTES); |
149 | 150 | const controller = new AbortController(); |
150 | 151 | const error = timeoutError(`HTTP request to ${url} timed out after ${timeoutMs}ms`); |
151 | | -let timeout: NodeJS.Timeout | undefined; |
| 152 | +let timeout: ReturnType<typeof setNodeTimeout> | undefined; |
152 | 153 | const timeoutPromise = new Promise<never>((_, reject) => { |
153 | | -timeout = setTimeout(() => { |
| 154 | +timeout = setNodeTimeout(() => { |
154 | 155 | controller.abort(error); |
155 | 156 | reject(error); |
156 | 157 | }, timeoutMs); |
@@ -176,7 +177,7 @@ export async function fetchJson(
|
176 | 177 | }); |
177 | 178 | } finally { |
178 | 179 | if (timeout) { |
179 | | -clearTimeout(timeout); |
| 180 | +clearNodeTimeout(timeout); |
180 | 181 | } |
181 | 182 | } |
182 | 183 | let parsed: unknown; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。