socket-function 1.1.8 → 1.1.9
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 +4 -2
- package/src/CallFactory.ts +4 -3
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "socket-function",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@types/pako": "^2.0.3",
|
|
8
8
|
"@types/ws": "^8.5.3",
|
|
9
9
|
"cbor-x": "^1.6.0",
|
|
10
|
-
"lmdb": "^3.5.1",
|
|
11
10
|
"mobx": "^6.6.2",
|
|
12
11
|
"pako": "^2.1.0",
|
|
13
12
|
"preact": "10.24.3",
|
|
@@ -15,6 +14,9 @@
|
|
|
15
14
|
"typenode": "^6.0.1",
|
|
16
15
|
"ws": "^8.17.1"
|
|
17
16
|
},
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"lmdb": "^3.5.1"
|
|
19
|
+
},
|
|
18
20
|
"types": "index.d.ts",
|
|
19
21
|
"scripts": {
|
|
20
22
|
"test": "yarn typenode ./test.ts",
|
package/src/CallFactory.ts
CHANGED
|
@@ -720,12 +720,13 @@ export async function createCallFactory(
|
|
|
720
720
|
if (!pendingCall) {
|
|
721
721
|
throw new Error(`Received data without size ${message.byteLength}B, first 100 bytes: ${message.slice(0, 100).toString("hex")}`);
|
|
722
722
|
}
|
|
723
|
-
|
|
723
|
+
let totalSize = message.byteLength + pendingCall.buffers.reduce((a, b) => a + b.length, 0);
|
|
724
|
+
if (totalSize > 1000 * 1000 * 10 || pendingCall.bufferCount > 1000 && (pendingCall.buffers.length % 100 === 0)) {
|
|
724
725
|
if (pendingCall.buffers.length === 0) {
|
|
725
|
-
console.log(`Received large/many packets ${formatNumber(
|
|
726
|
+
console.log(`Received large/many packets ${formatNumber(totalSize)}B (${pendingCall.buffers.length} / ${pendingCall.bufferCount}) at ${Date.now()}`);
|
|
726
727
|
} else {
|
|
727
728
|
let elapsed = Date.now() - (pendingCall.firstReceivedTime || 0);
|
|
728
|
-
console.log(`Received large/many packets ${formatNumber(
|
|
729
|
+
console.log(`Received large/many packets ${formatNumber(totalSize)}B (${pendingCall.buffers.length} / ${pendingCall.bufferCount}) after ${formatTime(elapsed)}`);
|
|
729
730
|
}
|
|
730
731
|
}
|
|
731
732
|
if (pendingCall.buffers.length === 0) {
|