fix: keep workbench alive on postgres timeout (#1831)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user