Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongodb

Package Overview
Dependencies
Maintainers
8
Versions
590
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb - npm Package Compare versions

Comparing version 6.10.0-dev.20241112.sha.48ed47ec to 6.10.0-dev.20241113.sha.20564f7a

3

lib/cmap/connection_pool.js

@@ -199,4 +199,3 @@ "use strict";

finally {
if (options.timeoutContext.clearConnectionCheckoutTimeout)
timeout?.clear();
timeout?.clear();
}

@@ -203,0 +202,0 @@ }

@@ -218,7 +218,3 @@ "use strict";

};
if (!options.omitMaxTimeMS) {
const maxTimeMS = options.timeoutContext?.maxTimeMS;
if (maxTimeMS && maxTimeMS > 0 && Number.isFinite(maxTimeMS))
cmd.maxTimeMS = maxTimeMS;
}
options.timeoutContext?.addMaxTimeMSToCommand(cmd, options);
const message = this.supportsOpMsg

@@ -231,11 +227,6 @@ ? new commands_1.OpMsgRequest(db, cmd, commandOptions)

this.throwIfAborted();
if (options.timeoutContext?.csotEnabled()) {
this.socket.setTimeout(0);
}
else if (typeof options.socketTimeoutMS === 'number') {
this.socket.setTimeout(options.socketTimeoutMS);
}
else if (this.socketTimeoutMS !== 0) {
this.socket.setTimeout(this.socketTimeoutMS);
}
const timeout = options.socketTimeoutMS ??
options?.timeoutContext?.getSocketTimeoutMS() ??
this.socketTimeoutMS;
this.socket.setTimeout(timeout);
try {

@@ -263,8 +254,3 @@ await this.writeCommand(message, {

this.throwIfAborted();
if (typeof options.socketTimeoutMS === 'number') {
this.socket.setTimeout(options.socketTimeoutMS);
}
else if (this.socketTimeoutMS !== 0) {
this.socket.setTimeout(this.socketTimeoutMS);
}
this.socket.setTimeout(timeout);
}

@@ -271,0 +257,0 @@ }

@@ -854,5 +854,2 @@ "use strict";

}
get clearConnectionCheckoutTimeout() {
return this.timeoutContext.clearConnectionCheckoutTimeout;
}
get timeoutForSocketWrite() {

@@ -884,4 +881,10 @@ return this.timeoutContext.timeoutForSocketWrite;

}
addMaxTimeMSToCommand(command, options) {
this.timeoutContext.addMaxTimeMSToCommand(command, options);
}
getSocketTimeoutMS() {
return this.timeoutContext.getSocketTimeoutMS();
}
}
exports.CursorTimeoutContext = CursorTimeoutContext;
//# sourceMappingURL=abstract_cursor.js.map

@@ -134,3 +134,2 @@ "use strict";

this.clearServerSelectionTimeout = false;
this.clearConnectionCheckoutTimeout = true;
}

@@ -235,2 +234,12 @@ get maxTimeMS() {

}
addMaxTimeMSToCommand(command, options) {
if (options.omitMaxTimeMS)
return;
const maxTimeMS = this.remainingTimeMS - this.minRoundTripTime;
if (maxTimeMS > 0 && Number.isFinite(maxTimeMS))
command.maxTimeMS = maxTimeMS;
}
getSocketTimeoutMS() {
return 0;
}
}

@@ -244,3 +253,2 @@ exports.CSOTTimeoutContext = CSOTTimeoutContext;

this.clearServerSelectionTimeout = true;
this.clearConnectionCheckoutTimeout = true;
}

@@ -278,4 +286,10 @@ csotEnabled() {

}
addMaxTimeMSToCommand(_command, _options) {
// No max timeMS is added to commands in legacy timeout mode.
}
getSocketTimeoutMS() {
return this.options.socketTimeoutMS;
}
}
exports.LegacyTimeoutContext = LegacyTimeoutContext;
//# sourceMappingURL=timeout.js.map
{
"name": "mongodb",
"version": "6.10.0-dev.20241112.sha.48ed47ec",
"version": "6.10.0-dev.20241113.sha.20564f7a",
"description": "The official MongoDB driver for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -405,3 +405,3 @@ import { clearTimeout, setTimeout } from 'timers';

} finally {
if (options.timeoutContext.clearConnectionCheckoutTimeout) timeout?.clear();
timeout?.clear();
}

@@ -408,0 +408,0 @@ }

@@ -430,6 +430,3 @@ import { type Readable, Transform, type TransformCallback } from 'stream';

if (!options.omitMaxTimeMS) {
const maxTimeMS = options.timeoutContext?.maxTimeMS;
if (maxTimeMS && maxTimeMS > 0 && Number.isFinite(maxTimeMS)) cmd.maxTimeMS = maxTimeMS;
}
options.timeoutContext?.addMaxTimeMSToCommand(cmd, options);

@@ -450,9 +447,7 @@ const message = this.supportsOpMsg

if (options.timeoutContext?.csotEnabled()) {
this.socket.setTimeout(0);
} else if (typeof options.socketTimeoutMS === 'number') {
this.socket.setTimeout(options.socketTimeoutMS);
} else if (this.socketTimeoutMS !== 0) {
this.socket.setTimeout(this.socketTimeoutMS);
}
const timeout =
options.socketTimeoutMS ??
options?.timeoutContext?.getSocketTimeoutMS() ??
this.socketTimeoutMS;
this.socket.setTimeout(timeout);

@@ -492,7 +487,3 @@ try {

if (typeof options.socketTimeoutMS === 'number') {
this.socket.setTimeout(options.socketTimeoutMS);
} else if (this.socketTimeoutMS !== 0) {
this.socket.setTimeout(this.socketTimeoutMS);
}
this.socket.setTimeout(timeout);
}

@@ -499,0 +490,0 @@ } finally {

@@ -1172,5 +1172,2 @@ import { Readable, Transform } from 'stream';

}
override get clearConnectionCheckoutTimeout(): boolean {
return this.timeoutContext.clearConnectionCheckoutTimeout;
}
override get timeoutForSocketWrite(): Timeout | null {

@@ -1194,10 +1191,14 @@ return this.timeoutContext.timeoutForSocketWrite;

}
get timeoutMS(): number | null {
return this.timeoutContext.csotEnabled() ? this.timeoutContext.timeoutMS : null;
}
override refreshed(): CursorTimeoutContext {
return new CursorTimeoutContext(this.timeoutContext.refreshed(), this.owner);
}
override addMaxTimeMSToCommand(command: Document, options: { omitMaxTimeMS?: boolean }): void {
this.timeoutContext.addMaxTimeMSToCommand(command, options);
}
override getSocketTimeoutMS(): number | undefined {
return this.timeoutContext.getSocketTimeoutMS();
}
}
import { clearTimeout, setTimeout } from 'timers';
import { type Document } from './bson';
import { MongoInvalidArgumentError, MongoOperationTimeoutError, MongoRuntimeError } from './error';

@@ -174,4 +175,2 @@ import { type ClientSession } from './sessions';

abstract get clearConnectionCheckoutTimeout(): boolean;
abstract get timeoutForSocketWrite(): Timeout | null;

@@ -189,2 +188,6 @@

abstract refreshed(): TimeoutContext;
abstract addMaxTimeMSToCommand(command: Document, options: { omitMaxTimeMS?: boolean }): void;
abstract getSocketTimeoutMS(): number | undefined;
}

@@ -198,3 +201,2 @@

clearConnectionCheckoutTimeout: boolean;
clearServerSelectionTimeout: boolean;

@@ -218,3 +220,2 @@

this.clearServerSelectionTimeout = false;
this.clearConnectionCheckoutTimeout = true;
}

@@ -332,2 +333,12 @@

}
override addMaxTimeMSToCommand(command: Document, options: { omitMaxTimeMS?: boolean }): void {
if (options.omitMaxTimeMS) return;
const maxTimeMS = this.remainingTimeMS - this.minRoundTripTime;
if (maxTimeMS > 0 && Number.isFinite(maxTimeMS)) command.maxTimeMS = maxTimeMS;
}
override getSocketTimeoutMS(): number | undefined {
return 0;
}
}

@@ -339,3 +350,2 @@

clearServerSelectionTimeout: boolean;
clearConnectionCheckoutTimeout: boolean;

@@ -346,3 +356,2 @@ constructor(options: LegacyTimeoutContextOptions) {

this.clearServerSelectionTimeout = true;
this.clearConnectionCheckoutTimeout = true;
}

@@ -389,2 +398,10 @@

}
override addMaxTimeMSToCommand(_command: Document, _options: { omitMaxTimeMS?: boolean }): void {
// No max timeMS is added to commands in legacy timeout mode.
}
override getSocketTimeoutMS(): number | undefined {
return this.options.socketTimeoutMS;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc