wardx 0.9.1 → 0.9.2
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/package.json +2 -2
- package/src/WardxNode.js +12 -2
- package/src/compression/gzip.js +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wardx",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Node.js SDK for Wardx telemetry, Remote Config, and experiments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wardx",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wardx/core": "0.9.
|
|
40
|
+
"@wardx/core": "0.9.2"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/WardxNode.js
CHANGED
|
@@ -50,6 +50,7 @@ export class WardxNode {
|
|
|
50
50
|
this._stopped = false;
|
|
51
51
|
this._shutdownPromise = null;
|
|
52
52
|
this._syncChain = Promise.resolve();
|
|
53
|
+
this._queuedSync = null;
|
|
53
54
|
this._instanceId = ulid();
|
|
54
55
|
this._sessionId = ulid();
|
|
55
56
|
this._aggregateTimer = setInterval(() => {
|
|
@@ -127,7 +128,16 @@ export class WardxNode {
|
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
_enqueueSync(flags) {
|
|
130
|
-
this.
|
|
131
|
+
if (this._queuedSync && !this._queuedSync.bootstrap) {
|
|
132
|
+
this._queuedSync.flush ||= flags.flush;
|
|
133
|
+
return this._syncChain;
|
|
134
|
+
}
|
|
135
|
+
this._queuedSync = flags;
|
|
136
|
+
const run = () => {
|
|
137
|
+
if (this._queuedSync === flags) this._queuedSync = null;
|
|
138
|
+
return this._syncOnce(flags);
|
|
139
|
+
};
|
|
140
|
+
this._syncChain = this._syncChain.then(run, run);
|
|
131
141
|
return this._syncChain;
|
|
132
142
|
}
|
|
133
143
|
|
|
@@ -168,7 +178,7 @@ export class WardxNode {
|
|
|
168
178
|
frames
|
|
169
179
|
};
|
|
170
180
|
const json = JSON.stringify(envelope);
|
|
171
|
-
const compressed = gzipBuffer(json);
|
|
181
|
+
const compressed = await gzipBuffer(json);
|
|
172
182
|
const bytesUncompressed = Buffer.byteLength(json);
|
|
173
183
|
const bytesCompressed = compressed.length;
|
|
174
184
|
this._core.internal.bytesUncompressed += bytesUncompressed;
|
package/src/compression/gzip.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { promisify } from 'node:util';
|
|
2
|
+
import { gzip, gunzipSync } from 'node:zlib';
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
return gzipSync(input);
|
|
5
|
-
}
|
|
4
|
+
export const gzipBuffer = promisify(gzip);
|
|
6
5
|
|
|
7
6
|
export function gunzipBuffer(input) {
|
|
8
7
|
return gunzipSync(input);
|