querysub 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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "querysub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"node-forge": "https://github.com/sliftist/forge#e618181b469b07bdc70b968b0391beb8ef5fecd6",
|
|
25
25
|
"pako": "^2.1.0",
|
|
26
26
|
"preact": "^10.11.3",
|
|
27
|
-
"socket-function": "^0.
|
|
27
|
+
"socket-function": "^0.38.0",
|
|
28
28
|
"terser": "^5.31.0",
|
|
29
29
|
"typesafecss": "^0.6.3",
|
|
30
30
|
"yaml": "^2.5.0",
|
|
@@ -68,13 +68,11 @@ const getAPI = lazy(async () => {
|
|
|
68
68
|
}
|
|
69
69
|
try {
|
|
70
70
|
let url = auth.apiUrl + "/b2api/v2/" + name;
|
|
71
|
-
console.log(`Backblaze API ${type} ${url}`);
|
|
72
71
|
let result = await httpsRequest(url, Buffer.from(JSON.stringify(arg)), type, undefined, {
|
|
73
72
|
headers: {
|
|
74
73
|
Authorization: auth.authorizationToken,
|
|
75
74
|
}
|
|
76
75
|
});
|
|
77
|
-
console.log(`Finished Backblaze API ${type} ${url}`);
|
|
78
76
|
return JSON.parse(result.toString());
|
|
79
77
|
} catch (e: any) {
|
|
80
78
|
throw new Error(`Error in ${name}, arg ${JSON.stringify(arg).slice(0, 1000)}: ${e.stack}`);
|
|
@@ -386,7 +386,7 @@ async function runMainSyncLoops(discoveryReady: PromiseObj<void>) {
|
|
|
386
386
|
await timeoutToUndefinedSilent(timeInSecond * 5, errorToUndefinedSilent(NodeDiscoveryController.nodes[nodeId].addNode(getOwnNodeId())));
|
|
387
387
|
}));
|
|
388
388
|
|
|
389
|
-
console.log(magenta(`Node discovery is
|
|
389
|
+
console.log(magenta(`Node discovery is loaded`));
|
|
390
390
|
|
|
391
391
|
await runInfinitePoll(HEARTBEAT_INTERVAL, async function nodeDiscoverHeartbeat() {
|
|
392
392
|
// If we waited too long, other nodes might think we are dead. In which case, we SHOULD terminate.
|
|
@@ -207,6 +207,7 @@ class NodePathAuthorities {
|
|
|
207
207
|
|
|
208
208
|
let first = true;
|
|
209
209
|
let firstPromise = new PromiseObj<unknown>();
|
|
210
|
+
logErrors(firstPromise.promise);
|
|
210
211
|
|
|
211
212
|
const ingestNewNodeIds = (newNodeIds: string[], removedNodeIds: string[]) => {
|
|
212
213
|
for (let nodeId of removedNodeIds) {
|
|
@@ -216,7 +217,9 @@ class NodePathAuthorities {
|
|
|
216
217
|
let nodeIds = newNodeIds;
|
|
217
218
|
nodeIds = nodeIds.filter(nodeId => !isOwnNodeId(nodeId));
|
|
218
219
|
let newNodes = nodeIds.filter(nodeId => !this.authorities.has(nodeId));
|
|
220
|
+
|
|
219
221
|
let timeout = first ? POLL_RATE : 0;
|
|
222
|
+
let isCurrentFirst = first;
|
|
220
223
|
first = false;
|
|
221
224
|
|
|
222
225
|
let promise = Promise.allSettled(newNodes.map(async nodeId => {
|
|
@@ -230,7 +233,7 @@ class NodePathAuthorities {
|
|
|
230
233
|
}
|
|
231
234
|
|
|
232
235
|
let time = Date.now();
|
|
233
|
-
let createTime = await
|
|
236
|
+
let createTime = await timeoutToUndefinedSilent(POLL_RATE, PathController.nodes[nodeId].getCreateTime());
|
|
234
237
|
if (createTime === undefined) {
|
|
235
238
|
// Don't log for 127-0-0-1, as it usually fails, and is mostly a development optimization
|
|
236
239
|
if (!nodeId.includes("127-0-0-1")) {
|
|
@@ -282,8 +285,9 @@ class NodePathAuthorities {
|
|
|
282
285
|
finished = true;
|
|
283
286
|
}
|
|
284
287
|
}));
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
if (isCurrentFirst) {
|
|
289
|
+
firstPromise.resolve(promise);
|
|
290
|
+
}
|
|
287
291
|
};
|
|
288
292
|
|
|
289
293
|
let time = Date.now();
|