mongodb 6.6.0 → 6.6.1-dev.20240507.sha.706cc56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/timeout.js +5 -5
- package/lib/timeout.js.map +1 -1
- package/package.json +2 -2
- package/src/timeout.ts +5 -5
package/lib/timeout.js
CHANGED
|
@@ -28,7 +28,7 @@ class Timeout extends Promise {
|
|
|
28
28
|
return 'MongoDBTimeout';
|
|
29
29
|
}
|
|
30
30
|
/** Create a new timeout that expires in `duration` ms */
|
|
31
|
-
constructor(executor = () => null, duration) {
|
|
31
|
+
constructor(executor = () => null, duration, unref = false) {
|
|
32
32
|
let reject;
|
|
33
33
|
if (duration < 0) {
|
|
34
34
|
throw new error_1.MongoInvalidArgumentError('Cannot create a Timeout with a negative duration');
|
|
@@ -47,8 +47,8 @@ class Timeout extends Promise {
|
|
|
47
47
|
this.timedOut = true;
|
|
48
48
|
reject(new TimeoutError(`Expired after ${duration}ms`));
|
|
49
49
|
}, this.duration);
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (typeof this.id.unref === 'function' && unref) {
|
|
51
|
+
// Ensure we do not keep the Node.js event loop running
|
|
52
52
|
this.id.unref();
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -60,8 +60,8 @@ class Timeout extends Promise {
|
|
|
60
60
|
(0, timers_1.clearTimeout)(this.id);
|
|
61
61
|
this.id = undefined;
|
|
62
62
|
}
|
|
63
|
-
static expires(durationMS) {
|
|
64
|
-
return new Timeout(undefined, durationMS);
|
|
63
|
+
static expires(durationMS, unref) {
|
|
64
|
+
return new Timeout(undefined, durationMS, unref);
|
|
65
65
|
}
|
|
66
66
|
static is(timeout) {
|
|
67
67
|
return (typeof timeout === 'object' &&
|
package/lib/timeout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":";;;AAAA,mCAAkD;A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ACtB,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC;IACtB,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,UAAkB,EAAE,KAAe;QACvD,OAAO,IAAI,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,OAAgB;QACxB,OAAO,CACL,OAAO,OAAO,KAAK,QAAQ;YAC3B,OAAO,IAAI,IAAI;YACf,MAAM,CAAC,WAAW,IAAI,OAAO;YAC7B,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,gBAAgB;YAChD,MAAM,IAAI,OAAO;YACjB,0CAA0C;YAC1C,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,CACnC,CAAC;IACJ,CAAC;CACF;AAjED,0BAiEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.1-dev.20240507.sha.706cc56",
|
|
4
4
|
"description": "The official MongoDB driver for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -175,4 +175,4 @@
|
|
|
175
175
|
"moduleResolution": "node"
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
}
|
|
178
|
+
}
|
package/src/timeout.ts
CHANGED
|
@@ -41,7 +41,7 @@ export class Timeout extends Promise<never> {
|
|
|
41
41
|
public timedOut = false;
|
|
42
42
|
|
|
43
43
|
/** Create a new timeout that expires in `duration` ms */
|
|
44
|
-
private constructor(executor: Executor = () => null, duration: number) {
|
|
44
|
+
private constructor(executor: Executor = () => null, duration: number, unref = false) {
|
|
45
45
|
let reject!: Reject;
|
|
46
46
|
|
|
47
47
|
if (duration < 0) {
|
|
@@ -63,8 +63,8 @@ export class Timeout extends Promise<never> {
|
|
|
63
63
|
this.timedOut = true;
|
|
64
64
|
reject(new TimeoutError(`Expired after ${duration}ms`));
|
|
65
65
|
}, this.duration);
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (typeof this.id.unref === 'function' && unref) {
|
|
67
|
+
// Ensure we do not keep the Node.js event loop running
|
|
68
68
|
this.id.unref();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -78,8 +78,8 @@ export class Timeout extends Promise<never> {
|
|
|
78
78
|
this.id = undefined;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
public static expires(durationMS: number): Timeout {
|
|
82
|
-
return new Timeout(undefined, durationMS);
|
|
81
|
+
public static expires(durationMS: number, unref?: boolean): Timeout {
|
|
82
|
+
return new Timeout(undefined, durationMS, unref);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
static is(timeout: unknown): timeout is Timeout {
|