Skip to content

Commit d522a1f

Browse files
committed
chore: fix cursor clean up
1 parent 51b9add commit d522a1f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test/integration/node-specific/abort_signal.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ describe('AbortSignal support', () => {
9595
logs.length = 0;
9696
const utilClient = this.configuration.newClient();
9797
try {
98-
await utilClient.db('abortSignal').command({ killCursors: 'support', cursors });
98+
if (cursors.length) {
99+
await utilClient.db('abortSignal').command({ killCursors: 'support', cursors });
100+
cursors.length = 0;
101+
}
99102
await utilClient.db('abortSignal').collection('support').deleteMany({});
100103
} finally {
101104
await utilClient.close();

test/integration/node-specific/auto_connect.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ describe('When executing an operation for the first time', () => {
244244
});
245245

246246
afterEach(async function () {
247-
await client.db('auto-connect-change').command({ killCursors: 'auto-connect', cursors });
247+
if (cursors.length) {
248+
await client.db('auto-connect-change').command({ killCursors: 'auto-connect', cursors });
249+
cursors.length = 0;
250+
}
248251
await changeCausingClient?.close();
249252
await cs?.close();
250253
});

0 commit comments

Comments
 (0)