+8
-8
| { | ||
| "name": "lmdb", | ||
| "author": "Kris Zyp", | ||
| "version": "3.5.4", | ||
| "version": "3.5.5", | ||
| "description": "Simple, efficient, scalable, high-performance LMDB interface", | ||
@@ -116,10 +116,10 @@ "license": "MIT", | ||
| "optionalDependencies": { | ||
| "@lmdb/lmdb-darwin-arm64": "3.5.4", | ||
| "@lmdb/lmdb-darwin-x64": "3.5.4", | ||
| "@lmdb/lmdb-linux-arm": "3.5.4", | ||
| "@lmdb/lmdb-linux-arm64": "3.5.4", | ||
| "@lmdb/lmdb-linux-x64": "3.5.4", | ||
| "@lmdb/lmdb-win32-arm64": "3.5.4", | ||
| "@lmdb/lmdb-win32-x64": "3.5.4" | ||
| "@lmdb/lmdb-darwin-arm64": "3.5.5", | ||
| "@lmdb/lmdb-darwin-x64": "3.5.5", | ||
| "@lmdb/lmdb-linux-arm": "3.5.5", | ||
| "@lmdb/lmdb-linux-arm64": "3.5.5", | ||
| "@lmdb/lmdb-linux-x64": "3.5.5", | ||
| "@lmdb/lmdb-win32-arm64": "3.5.5", | ||
| "@lmdb/lmdb-win32-x64": "3.5.5" | ||
| } | ||
| } |
+24
-1
@@ -593,2 +593,6 @@ import { ExtendedIterable } from '@harperfast/extended-iterable'; | ||
| txn.renewingRefCount = (txn.renewingRefCount || 0) + 1; // need to know how many are renewing cursors | ||
| // Track renewing cursors so that if this txn is orphaned (notCurrent) and its | ||
| // non-renewing refs later drain, we can release the snapshot instead of letting | ||
| // these cursors pin it (they don't need a stable snapshot). See Txn.done. | ||
| (txn.renewingCursors || (txn.renewingCursors = new Set())).add(cursor); | ||
| } | ||
@@ -698,3 +702,6 @@ } catch (error) { | ||
| if (iterable.onDone) iterable.onDone(); | ||
| if (cursorRenewId) txn.renewingRefCount--; | ||
| if (cursorRenewId) { | ||
| txn.renewingRefCount--; | ||
| txn.renewingCursors?.delete(cursor); | ||
| } | ||
| if (txn.refCount <= 1 && txn.notCurrent) { | ||
@@ -1091,2 +1098,18 @@ cursor.close(); // this must be closed before the transaction is aborted or it can cause a | ||
| this.isDone = true; | ||
| } else if ( | ||
| this.notCurrent && | ||
| !this.isDone && | ||
| this.refCount > 0 && | ||
| this.refCount === (this.renewingRefCount || 0) | ||
| ) { | ||
| // The only remaining refs on this orphaned snapshot are renewing (snapshot:false) | ||
| // cursors, which don't need a stable snapshot. Release it now rather than letting | ||
| // them pin it until they next iterate (they may be suspended across an await). | ||
| // Close the cursors first — aborting a txn with attached open cursors is unsafe — | ||
| // then abort; their iterators re-acquire on the current read txn via the txn.isDone | ||
| // reposition path in the range iterator. | ||
| for (const cursor of this.renewingCursors) cursor.close(); | ||
| this.renewingCursors.clear(); | ||
| this.abort(); | ||
| this.isDone = true; | ||
| } else if (this.refCount < 0) | ||
@@ -1093,0 +1116,0 @@ throw new Error('Can not finish a transaction more times than it was used'); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2547271
0.16%7571
0.61%