@prisma/query-plan-executor 8.1.0-dev.10 → 8.1.0-dev.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +43 -5
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -72089,7 +72089,7 @@ __export(index_exports, {
72089
72089
  module.exports = __toCommonJS(index_exports);
72090
72090
 
72091
72091
  // package.json
72092
- var version = "8.1.0-dev.10";
72092
+ var version = "8.1.0-dev.11";
72093
72093
 
72094
72094
  // ../../node_modules/.pnpm/temporal-polyfill@0.3.0/node_modules/temporal-polyfill/chunks/internal.js
72095
72095
  function clampProp(e2, n2, t2, o2, r2) {
@@ -104577,15 +104577,53 @@ var PgTransaction = class extends PgQueryable {
104577
104577
  this.pgOptions = pgOptions;
104578
104578
  this.cleanup = cleanup;
104579
104579
  }
104580
+ settled = false;
104581
+ inFlightQueries = 0;
104582
+ async performIO(query2) {
104583
+ if (this.settled) {
104584
+ throw new DriverAdapterError({
104585
+ kind: "TransactionAlreadyClosed",
104586
+ cause: "The transaction has already been committed or rolled back"
104587
+ });
104588
+ }
104589
+ this.inFlightQueries++;
104590
+ try {
104591
+ return await super.performIO(query2);
104592
+ } finally {
104593
+ this.inFlightQueries--;
104594
+ }
104595
+ }
104596
+ /**
104597
+ * Settles the transaction at most once. The query engine can settle twice when
104598
+ * an interactive transaction timeout expires while COMMIT is in flight: the
104599
+ * abandoned commit chain and the compensating rollback both reach the adapter
104600
+ * (https://github.com/prisma/prisma/issues/29952). A second `release()` would
104601
+ * corrupt pg-pool's accounting once the pool has re-lent the client, so it is
104602
+ * skipped, and a client with statements still in flight is released with an
104603
+ * error so the pool destroys the connection instead of re-lending a busy one.
104604
+ */
104605
+ settle() {
104606
+ if (this.settled) {
104607
+ return;
104608
+ }
104609
+ this.settled = true;
104610
+ try {
104611
+ this.cleanup?.();
104612
+ } finally {
104613
+ if (this.inFlightQueries > 0) {
104614
+ this.client.release(new Error("Transaction settled with statements still in flight"));
104615
+ } else {
104616
+ this.client.release();
104617
+ }
104618
+ }
104619
+ }
104580
104620
  async commit() {
104581
104621
  debug6(`[js::commit]`);
104582
- this.cleanup?.();
104583
- this.client.release();
104622
+ this.settle();
104584
104623
  }
104585
104624
  async rollback() {
104586
104625
  debug6(`[js::rollback]`);
104587
- this.cleanup?.();
104588
- this.client.release();
104626
+ this.settle();
104589
104627
  }
104590
104628
  async createSavepoint(name22) {
104591
104629
  await this.executeRaw({ sql: `SAVEPOINT ${name22}`, args: [], argTypes: [] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/query-plan-executor",
3
- "version": "8.1.0-dev.10",
3
+ "version": "8.1.0-dev.11",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,11 +19,11 @@
19
19
  "hono": "^4.12.23",
20
20
  "temporal-polyfill": "0.3.0",
21
21
  "zod": "4.1.3",
22
- "@prisma/adapter-pg": "8.1.0-dev.10",
23
- "@prisma/adapter-mssql": "8.1.0-dev.10",
24
- "@prisma/driver-adapter-utils": "8.1.0-dev.10",
25
- "@prisma/adapter-mariadb": "8.1.0-dev.10",
26
- "@prisma/client-engine-runtime": "8.1.0-dev.10"
22
+ "@prisma/adapter-pg": "8.1.0-dev.11",
23
+ "@prisma/client-engine-runtime": "8.1.0-dev.11",
24
+ "@prisma/driver-adapter-utils": "8.1.0-dev.11",
25
+ "@prisma/adapter-mssql": "8.1.0-dev.11",
26
+ "@prisma/adapter-mariadb": "8.1.0-dev.11"
27
27
  },
28
28
  "files": [
29
29
  "dist"