querysub 0.713.0 → 0.714.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.714.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",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"node-forge": "https://github.com/sliftist/forge#e618181b469b07bdc70b968b0391beb8ef5fecd6",
|
|
80
80
|
"pako": "^2.1.0",
|
|
81
81
|
"peggy": "^5.0.6",
|
|
82
|
-
"sliftutils": "^1.
|
|
82
|
+
"sliftutils": "^1.9.5",
|
|
83
83
|
"socket-function": "^1.3.1",
|
|
84
84
|
"terser": "^5.31.0",
|
|
85
85
|
"typenode": "^6.6.1",
|
|
@@ -40,9 +40,9 @@ function createSourceWindows(
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function archiveBuilder(bucket: string, overrides: Partial<RemoteConfigBase>) {
|
|
43
|
-
const ONTARIO = `https://99-
|
|
43
|
+
const ONTARIO = `https://99-255-70-23.querysubtest.com:5234/file/${STORAGE_ACCOUNT}/${bucket}/storage/storagerouting.json`;
|
|
44
44
|
// NOTE: This is on an overly large extra disk that's on our 4090 machine. I prefer to not use it because it might slow down diffusion, but it's quite large (2tb, and diffusion will never use more than 1tb), so we could use it if we needed to.
|
|
45
|
-
const ONTARIO2 = `https://99-
|
|
45
|
+
const ONTARIO2 = `https://99-255-70-23.querysubtest.com:5235/file/${STORAGE_ACCOUNT}/${bucket}/storage/storagerouting.json`;
|
|
46
46
|
const HETZNER = `https://65-109-93-113.querysubtest.com:5234/file/${STORAGE_ACCOUNT}/${bucket}/storage/storagerouting.json`;
|
|
47
47
|
const BACKBLAZE = `https://f002.backblazeb2.com/file/${bucket}/storage/storagerouting.json`;
|
|
48
48
|
|
|
@@ -184,7 +184,7 @@ export function getArchives2Debug(folder: string) {
|
|
|
184
184
|
sources: [
|
|
185
185
|
// IMPORTANT! If we start changing around routes, it could resurrect old data. We can fix this via incrementing the route version.
|
|
186
186
|
{
|
|
187
|
-
type: "remote", url: `https://99-
|
|
187
|
+
type: "remote", url: `https://99-255-70-23.querysubtest.com:5239/file/${STORAGE_ACCOUNT}/${folder}/storage/storagerouting.json`,
|
|
188
188
|
validWindow: [0, Number.MAX_SAFE_INTEGER],
|
|
189
189
|
route: [0, 0.5],
|
|
190
190
|
name: "storagea_v" + routeVersion,
|
|
@@ -3,7 +3,6 @@ import os from "os";
|
|
|
3
3
|
import { fsExistsAsync } from "../fs";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import { blue, red, yellow } from "socket-function/src/formatting/logColors";
|
|
6
|
-
import { measureFnc } from "socket-function/src/profiling/measure";
|
|
7
6
|
import { delay } from "socket-function/src/batching";
|
|
8
7
|
import debugbreak from "debugbreak";
|
|
9
8
|
import { Archives } from "./archives";
|
|
@@ -147,7 +146,6 @@ class ArchivesDisk {
|
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
|
|
150
|
-
@measureFnc
|
|
151
149
|
public async gcDir(dir: string) {
|
|
152
150
|
await this.init();
|
|
153
151
|
if (!dir.startsWith(this.LOCAL_ARCHIVE_FOLDER)) {
|
|
@@ -187,8 +185,6 @@ class ArchivesDisk {
|
|
|
187
185
|
* it all at once).
|
|
188
186
|
* @fsErrorRetryCount Retries count for file system error (not user errors). Ex, too many open files, etc.
|
|
189
187
|
*/
|
|
190
|
-
// NOTE: I've commented out the gate measuring so we can determine what is taking the time. We might want to remove all the timing from this file, as if we find any timing this file is slow, it doesn't help us optimize at all, because we then need to figure out what is calling it.
|
|
191
|
-
//@measureFnc
|
|
192
188
|
public async get(fileNameInput: string, config?: { range?: { start: number; end: number; }; retryCount?: number }): Promise<Buffer | undefined> {
|
|
193
189
|
await this.init();
|
|
194
190
|
this.log(blue(`Start read file ${fileNameInput}`));
|
|
@@ -238,7 +234,6 @@ class ArchivesDisk {
|
|
|
238
234
|
}
|
|
239
235
|
}
|
|
240
236
|
|
|
241
|
-
@measureFnc
|
|
242
237
|
public async find(prefix: string, config?: { shallow?: boolean; type: "files" | "folders" }): Promise<string[]> {
|
|
243
238
|
await this.init();
|
|
244
239
|
prefix = escapeFileName(prefix);
|
|
@@ -293,7 +288,6 @@ class ArchivesDisk {
|
|
|
293
288
|
|
|
294
289
|
return results;
|
|
295
290
|
}
|
|
296
|
-
@measureFnc
|
|
297
291
|
public async findInfo(prefix: string, config?: { shallow?: boolean; type: "files" | "folders" }): Promise<{ path: string; createTime: number; size: number; }[]> {
|
|
298
292
|
// TODO: Isn't there any api to read file names and infos at the same time?
|
|
299
293
|
let files = await this.find(prefix, config);
|
|
@@ -308,7 +302,6 @@ class ArchivesDisk {
|
|
|
308
302
|
}
|
|
309
303
|
|
|
310
304
|
|
|
311
|
-
@measureFnc
|
|
312
305
|
public async getInfo(pathInput: string): Promise<{
|
|
313
306
|
writeTime: number;
|
|
314
307
|
size: number;
|
|
@@ -335,7 +328,6 @@ class ArchivesDisk {
|
|
|
335
328
|
escapeFileName(this.LOCAL_ARCHIVE_FOLDER + path);
|
|
336
329
|
}
|
|
337
330
|
|
|
338
|
-
@measureFnc
|
|
339
331
|
public async move(config: {
|
|
340
332
|
path: string;
|
|
341
333
|
target: Archives;
|
|
@@ -366,7 +358,6 @@ class ArchivesDisk {
|
|
|
366
358
|
}
|
|
367
359
|
}
|
|
368
360
|
|
|
369
|
-
@measureFnc
|
|
370
361
|
public async copy(config: {
|
|
371
362
|
path: string;
|
|
372
363
|
target: Archives;
|
|
@@ -96,7 +96,28 @@ done`;
|
|
|
96
96
|
export async function readProcessRecord(folder: string, pid: string, startTime: number): Promise<ProcessRecord | undefined> {
|
|
97
97
|
let file = getRecordPath(folder, pid, startTime);
|
|
98
98
|
if (!await fsExistsAsync(file)) return undefined;
|
|
99
|
-
return
|
|
99
|
+
return await parseRecordFile(file);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const reportedUnreadableRecords = new Set<string>();
|
|
103
|
+
|
|
104
|
+
async function parseRecordFile(file: string): Promise<ProcessRecord | undefined> {
|
|
105
|
+
let contents: string;
|
|
106
|
+
try {
|
|
107
|
+
contents = await fs.promises.readFile(file, "utf8");
|
|
108
|
+
} catch (e) {
|
|
109
|
+
if ((e as NodeJS.ErrnoException).code === "ENOENT") return undefined;
|
|
110
|
+
throw e;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
return JSON.parse(contents) as ProcessRecord;
|
|
114
|
+
} catch (e) {
|
|
115
|
+
if (!reportedUnreadableRecords.has(file)) {
|
|
116
|
+
reportedUnreadableRecords.add(file);
|
|
117
|
+
console.error(`[pid ${process.pid}] Ignoring unreadable process record ${file} (${contents.length} bytes). ${(e as Error).stack ?? e}`);
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
100
121
|
}
|
|
101
122
|
|
|
102
123
|
/** The live record for a pid in this folder. The pid is what identifies a process, so a start time that reads back a second off - the sources only resolve to the second - must not make us miss the record and write a duplicate. */
|
|
@@ -116,7 +137,10 @@ export async function markProcessDead(pid: string, now: number): Promise<void> {
|
|
|
116
137
|
|
|
117
138
|
export async function writeProcessRecord(record: ProcessRecord): Promise<void> {
|
|
118
139
|
await fs.promises.mkdir(path.join(record.folder, PROCESS_FOLDER), { recursive: true });
|
|
119
|
-
|
|
140
|
+
let file = getRecordPath(record.folder, record.pid, record.startTime);
|
|
141
|
+
let tempFile = `${file}.${process.pid}.tmp`;
|
|
142
|
+
await fs.promises.writeFile(tempFile, JSON.stringify(record));
|
|
143
|
+
await fs.promises.rename(tempFile, file);
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
async function readFolderRecords(folder: string): Promise<ProcessRecord[]> {
|
|
@@ -130,7 +154,10 @@ async function readFolderRecords(folder: string): Promise<ProcessRecord[]> {
|
|
|
130
154
|
let records: ProcessRecord[] = [];
|
|
131
155
|
for (let file of files) {
|
|
132
156
|
if (!file.endsWith(RECORD_SUFFIX)) continue;
|
|
133
|
-
|
|
157
|
+
let record = await parseRecordFile(path.join(processFolder, file));
|
|
158
|
+
if (record) {
|
|
159
|
+
records.push(record);
|
|
160
|
+
}
|
|
134
161
|
}
|
|
135
162
|
return records;
|
|
136
163
|
}
|
|
@@ -280,7 +280,6 @@ export class NodeViewer extends qreact.Component {
|
|
|
280
280
|
}
|
|
281
281
|
console.log(url);
|
|
282
282
|
console.log(url.replace("https://notdevtools.com/devtools", "devtools://devtools/bundled"));
|
|
283
|
-
// devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&wss=99-250-124-91.querysub.com:2058/cc5b76b2-549f-4a66-8026-021811e9edd3
|
|
284
283
|
|
|
285
284
|
window.open(url, "_blank");
|
|
286
285
|
}}>
|