Skip to content

Commit afbd62b

Browse files
ericallamclaude
andcommitted
fix(webapp): retry driver-adapter connectivity errors in the mollifier drainer
isRetryablePgError only recognized the Rust engine's DB-unreachable shapes (P1001 / "Can't reach database server"). Under a driver adapter the same outage surfaces as P2010 "Database not reachable" / ECONNREFUSED / ENOTFOUND, so buffered runs were permanently failed on a transient outage. Reuse the shared looksLikeConnectivityError predicate (now exported from prismaErrors) so those are retried too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 24286a0 commit afbd62b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

apps/webapp/app/utils/prismaErrors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const CONNECTIVITY_ERRNO = new Set([
3838
const CONNECTIVITY_MESSAGE =
3939
/ECONNREFUSED|ENOTFOUND|ETIMEDOUT|ECONNRESET|EHOSTUNREACH|database not reachable|can't reach database|connection terminated|server has closed the connection|timed out fetching a new connection/i;
4040

41-
function looksLikeConnectivityError(error: unknown): boolean {
41+
export function looksLikeConnectivityError(error: unknown): boolean {
4242
const e = error as { code?: unknown; message?: unknown };
4343
if (typeof e?.code === "string" && CONNECTIVITY_ERRNO.has(e.code)) {
4444
return true;

apps/webapp/app/v3/mollifier/mollifierDrainerHandler.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
MollifierDrainerTerminalFailureHandler,
88
} from "@trigger.dev/redis-worker";
99
import { logger } from "~/services/logger.server";
10+
import { looksLikeConnectivityError } from "~/utils/prismaErrors";
1011
import { recordRunDebugLog } from "~/v3/eventRepository/index.server";
1112
import { PerformTaskRunAlertsService } from "~/v3/services/alerts/performTaskRunAlerts.server";
1213
import { startSpan } from "~/v3/tracing.server";
@@ -29,6 +30,7 @@ export function isRetryablePgError(err: unknown): boolean {
2930
if (msg.includes("Can't reach database server")) return true;
3031
if (msg.includes("Connection lost")) return true;
3132
if (msg.includes("ECONNRESET")) return true;
33+
if (looksLikeConnectivityError(err)) return true;
3234
return false;
3335
}
3436

0 commit comments

Comments
 (0)