Skip to content

Commit 68e0072

Browse files
authored
fix: use a weaker tx consistency level for better perf (#326)
1 parent 981f643 commit 68e0072

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/runtime/src/client/crud/operations/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
20832083
} else {
20842084
// otherwise, create a new transaction and execute the callback
20852085
let txBuilder = this.kysely.transaction();
2086-
txBuilder = txBuilder.setIsolationLevel(isolationLevel ?? TransactionIsolationLevel.RepeatableRead);
2086+
txBuilder = txBuilder.setIsolationLevel(isolationLevel ?? TransactionIsolationLevel.ReadCommitted);
20872087
return txBuilder.execute(callback);
20882088
}
20892089
}

packages/runtime/src/client/executor/zenstack-query-executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class ZenStackQueryExecutor<Schema extends SchemaDef> extends DefaultQuer
9090
// mutations are wrapped in tx if not already in one
9191
if (this.isMutationNode(compiledQuery.query) && !this.driver.isTransactionConnection(connection)) {
9292
await this.driver.beginTransaction(connection, {
93-
isolationLevel: TransactionIsolationLevel.RepeatableRead,
93+
isolationLevel: TransactionIsolationLevel.ReadCommitted,
9494
});
9595
startedTx = true;
9696
}

0 commit comments

Comments
 (0)