socket-function 0.37.0 → 0.39.0
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 +1 -1
- package/src/https.ts +3 -1
- package/src/profiling/measure.ts +5 -1
- package/src/websocketFactory.ts +0 -6
package/package.json
CHANGED
package/src/https.ts
CHANGED
|
@@ -23,13 +23,15 @@ export function httpsRequest(
|
|
|
23
23
|
if (urlObj.port) {
|
|
24
24
|
port = +urlObj.port;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
return new Promise<Buffer>((resolve, reject) => {
|
|
28
27
|
let httpRequest = requestor.request(
|
|
29
28
|
urlObj + "",
|
|
30
29
|
{
|
|
31
30
|
method,
|
|
32
31
|
headers: config?.headers,
|
|
32
|
+
// NOTE: We get a lot of backblaze errors when we try to re-use connections. It might be faster,
|
|
33
|
+
// but... anything that cares about speed should use websockets anyways...
|
|
34
|
+
agent: new requestor.Agent({ keepAlive: false }),
|
|
33
35
|
},
|
|
34
36
|
async httpResponse => {
|
|
35
37
|
let data: Buffer[] = [];
|
package/src/profiling/measure.ts
CHANGED
|
@@ -30,7 +30,8 @@ const measureOverhead = 5 / 1000;
|
|
|
30
30
|
|
|
31
31
|
const AsyncFunction = (async () => { }).constructor;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
// NOTE: Also hardcoded in diskLogger.ts (in querysub)
|
|
34
|
+
const noDiskLogPrefix = "█ ";
|
|
34
35
|
|
|
35
36
|
// TIMING: 1-5us. I have seen timing values greatly vary, but it does seem to be quite high, despite
|
|
36
37
|
// microbenchmarks saying it is slow. Perhaps it is because getOwnTime breaks the cpu pipeline,
|
|
@@ -78,6 +79,9 @@ export function measureBlock<T extends (...args: any[]) => any>(fnc: T, name?: s
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
let extraInfoGetters: (() => string | undefined)[] = [];
|
|
82
|
+
/** NOTE: You should often call registerNodeMetadata for this as well. registerMeasureInfo
|
|
83
|
+
* is for logs, while registerNodeMetadata is for the overview page.
|
|
84
|
+
*/
|
|
81
85
|
export function registerMeasureInfo(getInfo: () => string | undefined) {
|
|
82
86
|
extraInfoGetters.push(getInfo);
|
|
83
87
|
}
|
package/src/websocketFactory.ts
CHANGED
|
@@ -38,12 +38,6 @@ export function createWebsocketFactory(): (nodeId: string) => SenderInterface {
|
|
|
38
38
|
}
|
|
39
39
|
let webSocket = new ws.WebSocket(`wss://${address}:${port}`, undefined, {
|
|
40
40
|
ca: getTrustedCertificates(),
|
|
41
|
-
// createConnection(options, oncreate) {
|
|
42
|
-
// // NOTE: If our latency is 500ms, with 10MB/s, then we need a high water
|
|
43
|
-
// // mark of at least 5MB, otherwise our connection is slowed down.
|
|
44
|
-
// //(options as any).writableHighWaterMark = 5 * 1024 * 1024;
|
|
45
|
-
// return tls.connect(options as any, oncreate as any);
|
|
46
|
-
// },
|
|
47
41
|
});
|
|
48
42
|
|
|
49
43
|
// NOTE: Little setup is done here, because Sometimes websockets are created here,
|