querysub 0.16.0 → 0.17.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
CHANGED
|
@@ -13,7 +13,7 @@ import { blue, green, magenta, red, yellow } from "socket-function/src/formattin
|
|
|
13
13
|
import debugbreak from "debugbreak";
|
|
14
14
|
import { getArchivesBackblaze, getBackblazePath } from "../-a-archives/archivesBackBlaze";
|
|
15
15
|
import { PromiseObj } from "../promise";
|
|
16
|
-
import { formatDateTime, formatTime } from "socket-function/src/formatting/format";
|
|
16
|
+
import { formatDateTime, formatTime, formatVeryNiceDateTime } from "socket-function/src/formatting/format";
|
|
17
17
|
import { isClient, isServer } from "../config2";
|
|
18
18
|
import { waitForFirstTimeSync } from "socket-function/time/trueTimeShim";
|
|
19
19
|
import { decodeNodeId, decodeNodeIdAssert, getMachineId } from "../-a-auth/certs";
|
|
@@ -37,7 +37,7 @@ let SUICIDE_HEARTBEAT_THRESHOLD = timeInMinute * 15;
|
|
|
37
37
|
|
|
38
38
|
let CLIENTSIDE_POLL_RATE = timeInMinute * 5;
|
|
39
39
|
|
|
40
|
-
let API_AUDIT_RATE = timeInSecond
|
|
40
|
+
let API_AUDIT_RATE = timeInSecond;
|
|
41
41
|
|
|
42
42
|
let MEMORY_AUDIT_RATE = timeInMinute * 5;
|
|
43
43
|
let MEMORY_AUDIT_COUNT = 3;
|
|
@@ -284,22 +284,22 @@ async function runHeartbeatAuditLoop() {
|
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
async function fastMemorySync(
|
|
288
|
-
let
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
287
|
+
async function fastMemorySync() {
|
|
288
|
+
let checkNodes = shuffle(Array.from(allNodeIds2).filter(x => x !== getOurNodeId()), Date.now()).slice(0, MEMORY_AUDIT_COUNT).slice(0, 10);
|
|
289
|
+
let otherNodesAll = await Promise.all(
|
|
290
|
+
checkNodes.map(async nodeId =>
|
|
291
|
+
await timeoutToUndefinedSilent(200, NodeDiscoveryController.nodes[nodeId].getAllNodeIds()) || []
|
|
292
|
+
)
|
|
293
|
+
);
|
|
294
|
+
let otherNodes = Array.from(new Set(otherNodesAll.flat()));
|
|
295
|
+
//console.log(magenta(`Fast memory sync at ${formatVeryNiceDateTime(Date.now())}, nodes found ${otherNodes.length}`));
|
|
296
|
+
|
|
297
297
|
// If they are missing nodes that's fine. We constantly have extra nodes, and have to function correctly
|
|
298
298
|
// with extra nodes. However, if we are missing nodes, we'd prefer to have them quickly, so we should
|
|
299
299
|
// sync now.
|
|
300
300
|
let missingNodes = otherNodes.filter(nodeId => !allNodeIds2.has(nodeId));
|
|
301
301
|
if (missingNodes.length > 0) {
|
|
302
|
-
console.log(yellow(`Node list is missing nodes, resyncing node`), {
|
|
302
|
+
console.log(yellow(`Node list is missing nodes, resyncing node`), { missingNodes, otherNodes });
|
|
303
303
|
await syncArchives();
|
|
304
304
|
}
|
|
305
305
|
}
|
|
@@ -473,6 +473,7 @@ const tellEveryoneNodesChanges = throttleFunction(1000, function tellEveryoneNod
|
|
|
473
473
|
|
|
474
474
|
class NodeDiscoveryControllerBase {
|
|
475
475
|
public async addNode(nodeId: string) {
|
|
476
|
+
console.log(magenta(`Received addNode`), { nodeId });
|
|
476
477
|
addNodeId(nodeId);
|
|
477
478
|
}
|
|
478
479
|
public async resyncNodes() {
|
|
@@ -483,7 +484,7 @@ class NodeDiscoveryControllerBase {
|
|
|
483
484
|
}
|
|
484
485
|
|
|
485
486
|
public async getAllNodeIds(): Promise<string[]> {
|
|
486
|
-
return Array.from(allNodeIds2);
|
|
487
|
+
return Array.from(allNodeIds2).filter(x => !x.startsWith("127-0-0-1."));
|
|
487
488
|
}
|
|
488
489
|
public async getNodeId() {
|
|
489
490
|
console.log(`Returning node id ${SocketFunction.mountedNodeId}`);
|
|
@@ -949,7 +949,9 @@ class PathControllerBase {
|
|
|
949
949
|
}
|
|
950
950
|
|
|
951
951
|
public async broadcastReadReady(time: number) {
|
|
952
|
-
|
|
952
|
+
let nodeIdCaller = IdentityController_getCurrentReconnectNodeIdAssert();
|
|
953
|
+
console.log(magenta(`Received ready broadcast`), { nodeIdCaller });
|
|
954
|
+
onReadyReady(nodeIdCaller, time);
|
|
953
955
|
}
|
|
954
956
|
}
|
|
955
957
|
const PathController = SocketFunction.register(
|
|
@@ -170,7 +170,10 @@ export class RemoteWatcher {
|
|
|
170
170
|
// us to circumvent earlier watchers, causing us to watch out of order, causing reads
|
|
171
171
|
// to come back out of order, causing watching functions to trigger out of order!
|
|
172
172
|
let remoteAuthorityId = this.remoteWatchPaths.get(path);
|
|
173
|
-
if (remoteAuthorityId !== undefined)
|
|
173
|
+
if (remoteAuthorityId !== undefined) {
|
|
174
|
+
this.disconnectedPaths.delete(path);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
174
177
|
|
|
175
178
|
let authorityId = pathValueAuthority2.getSingleReadNodeSync(path);
|
|
176
179
|
if (!authorityId) {
|