File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ This driver uses semantic versioning:
1616
1717## [ Unreleased]
1818
19+ ### Changed
20+
21+ - Killing a cursor now also drains it locally
22+
1923### Fixed
2024
2125- Fixed a potential memory leak in cursor batch handling
Original file line number Diff line number Diff line change @@ -601,9 +601,9 @@ export class BatchedArrayCursor<T = any> {
601601 }
602602
603603 /**
604- * Kills the cursor and frees up associated database resources.
604+ * Drains the cursor and frees up associated database resources.
605605 *
606- * This method has no effect if all batches have already been fetched .
606+ * This method has no effect if all batches have already been consumed .
607607 *
608608 * @example
609609 * ```js
@@ -620,6 +620,12 @@ export class BatchedArrayCursor<T = any> {
620620 * ```
621621 */
622622 async kill ( ) : Promise < void > {
623+ if ( this . _batches . length ) {
624+ for ( const batch of this . _batches . values ( ) ) {
625+ batch . clear ( ) ;
626+ }
627+ this . _batches . clear ( ) ;
628+ }
623629 if ( ! this . hasNext ) return undefined ;
624630 return this . _db . request (
625631 {
You can’t perform that action at this time.
0 commit comments