fix: keep workbench alive on postgres timeout (#1831)

This commit is contained in:
Lyon
2026-06-21 19:20:34 +08:00
committed by GitHub
parent f9bf6231b5
commit e23e9522d1
2 changed files with 8 additions and 1 deletions
+4
View File
@@ -243,6 +243,10 @@ function otelNonNegativeIntegerOrNull(value) {
return Number.isFinite(parsed) && parsed >= 0 ? Math.trunc(parsed) : null;
}
function objectValue(value) {
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
}
async function durableTraceSnapshot(runtimeStore, traceId) {
if (!runtimeStore || typeof runtimeStore.queryAgentTraceEvents !== "function") return null;
const safeId = safeTraceId(traceId);
+4 -1
View File
@@ -2835,7 +2835,10 @@ export function classifyRuntimeDbError(error) {
function isRuntimeDbConnectTimeout(error) {
const message = String(error?.message ?? error ?? "").toLowerCase();
if (!message.includes("timeout exceeded when trying to connect")) return false;
const pgConnectTimeout = message.includes("timeout exceeded when trying to connect");
const pgConnectionTimeoutTermination = message.includes("connection terminated due to connection timeout");
if (!pgConnectTimeout && !pgConnectionTimeoutTermination) return false;
if (pgConnectionTimeoutTermination) return true;
const stack = String(error?.stack ?? "").toLowerCase();
return !stack || stack.includes("pg-pool") || stack.includes("node_modules/pg");
}