Skip to content

Commit 24286a0

Browse files
ericallamclaude
andcommitted
fix(database): retry adapter pool-acquire timeouts in $transaction
The retry decision used retryCodes.includes(error.code) directly, inside the isPrismaKnownError branch, so the broadened isPrismaRetriableError check never governed retries. Route the retry decision through isPrismaRetriableError so the adapter's pool-acquire timeout is retried like P2024 was, while keeping prismaError()/swallow behavior for coded errors only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1c72e57 commit 24286a0

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

internal-packages/database/src/transaction.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ export async function $transaction<R>(
9393
try {
9494
return await (prisma as PrismaClient).$transaction(fn, options);
9595
} catch (error) {
96-
if (isPrismaKnownError(error)) {
97-
if (
98-
retryCodes.includes(error.code) &&
99-
typeof options?.maxRetries === "number" &&
100-
attempt < options.maxRetries
101-
) {
102-
return $transaction(prisma, fn, prismaError, options, attempt + 1);
103-
}
96+
if (
97+
isPrismaRetriableError(error) &&
98+
typeof options?.maxRetries === "number" &&
99+
attempt < options.maxRetries
100+
) {
101+
return $transaction(prisma, fn, prismaError, options, attempt + 1);
102+
}
104103

104+
if (isPrismaKnownError(error)) {
105105
prismaError(error);
106106

107107
if (options?.swallowPrismaErrors) {

0 commit comments

Comments
 (0)