Skip to content

Commit 0cd813f

Browse files
authored
Add instruction about specifiying timeout value in Interactive Transactions (#6548)
1 parent 4228308 commit 0cd813f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

content/300-accelerate/250-connection-pooling.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ Accelerate has a default global timeout of `15s` for each [interactive transacti
9191

9292
See the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and our [pricing page](https://www.prisma.io/pricing#accelerate) for more information.
9393

94+
When you set a higher interactive transaction timeout in the Prisma Console, you **must also** specify a matching `timeout` value in your interactive transaction query via timeout [transaction option](/orm/prisma-client/queries/transactions#transaction-options). Otherwise, transactions will still time out at the lower default (e.g., 5 seconds limit when no timeout value is specified). Here’s an example of how to set a 30-second timeout in your code:
95+
96+
```ts
97+
await prisma.$transaction(
98+
async (tx) => {
99+
// Your queries go here
100+
},
101+
{
102+
timeout: 30000, // 30s
103+
}
104+
);
105+
```
106+
94107
:::warning
95108
While you can increase the interactive transaction timeout limit, it’s recommended to inspect and optimize your database transactions if they take longer than 15 seconds. Long-running transactions can negatively impact performance and often signal the need for optimization. Learn more in the [troubleshooting guide](/accelerate/troubleshoot#p6004-querytimeout) and review the [warning in the Interactive Transactions section](/orm/prisma-client/queries/transactions#interactive-transactions-1) in our documentation.
96109
:::

0 commit comments

Comments
 (0)