mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:30:43 +00:00
fix: include fetch timeout context in console logs
This commit is contained in:
@@ -37,6 +37,8 @@ describe("buildTimeoutAbortSignal", () => {
|
||||
timeoutMs: 25,
|
||||
operation: "unit-test",
|
||||
url: "https://example.com/v1/responses",
|
||||
consoleMessage:
|
||||
"fetch timeout after 25ms (elapsed 25ms) operation=unit-test url=https://example.com/v1/responses",
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -64,9 +64,19 @@ function abortDueToTimeout(
|
||||
return;
|
||||
}
|
||||
const sanitizedUrl = sanitizeTimeoutLogUrl(url);
|
||||
const elapsedMs = Math.max(0, Date.now() - startedAtMs);
|
||||
const consoleMessage = [
|
||||
`fetch timeout after ${timeoutMs}ms`,
|
||||
`(elapsed ${elapsedMs}ms)`,
|
||||
operation ? `operation=${operation}` : null,
|
||||
sanitizedUrl ? `url=${sanitizedUrl}` : null,
|
||||
]
|
||||
.filter((part): part is string => Boolean(part))
|
||||
.join(" ");
|
||||
log.warn("fetch timeout reached; aborting operation", {
|
||||
timeoutMs,
|
||||
elapsedMs: Math.max(0, Date.now() - startedAtMs),
|
||||
elapsedMs,
|
||||
consoleMessage,
|
||||
...(operation ? { operation } : {}),
|
||||
...(sanitizedUrl ? { url: sanitizedUrl } : {}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user