Skip to content

Commit ffba0f4

Browse files
committed
fix: spelling, assertAlive always returns true
1 parent b9ed1fa commit ffba0f4

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

src/sessions.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@ import {
4242

4343
const minWireVersionForShardedTransactions = 8;
4444

45-
function assertAlive(session: ClientSession, callback?: Callback): boolean {
46-
if (session.serverSession == null) {
47-
const error = new MongoExpiredSessionError();
48-
if (typeof callback === 'function') {
49-
callback(error);
50-
return false;
51-
}
52-
53-
throw error;
54-
}
55-
56-
return true;
57-
}
58-
5945
/** @public */
6046
export interface ClientSessionOptions {
6147
/** Whether causal consistency should be enabled on this session */
@@ -393,7 +379,6 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
393379
throw new MongoCompatibilityError('Transactions are not allowed with snapshot sessions');
394380
}
395381

396-
assertAlive(this);
397382
if (this.inTransaction()) {
398383
throw new MongoTransactionError('Transaction already in progress');
399384
}
@@ -658,11 +643,6 @@ function endTransaction(
658643
commandName: 'abortTransaction' | 'commitTransaction',
659644
callback: Callback<Document>
660645
) {
661-
if (!assertAlive(session, callback)) {
662-
// checking result in case callback was called
663-
return;
664-
}
665-
666646
// handle any initial problematic cases
667647
const txnState = session.transaction.state;
668648

test/unit/sessions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('Sessions - unit', function () {
9191
expect(session.clusterTime).to.eql(clusterTime);
9292
});
9393

94-
it('should not acquire a serverSession inside incrementTxnNumber', () => {
94+
it('should not acquire a serverSession inside incrementTransactionNumber', () => {
9595
const client = new Topology(topologyHost, topologyOptions);
9696
const sessionPool = client.s.sessionPool;
9797
const session = new ClientSession(client, sessionPool, {});

0 commit comments

Comments
 (0)