Fix blocking upload logging and recover DoodStream socket failures; release 2.1.67
CI / verify (push) Canceled after 0s

This commit is contained in:
Sucukdeluxe committed 2026-10-18 01:34:05 +02:00
1 parent 5a0cad0ca5
commit 9b06b4f852
10 files changed
+254 -114

No files matched your search

+32
View File
@@ -48,6 +48,38 @@ class PerformanceMonitor {
const durationMs = this.monotonic() - started;
this.record('renderer.roundtrip', durationMs);
}
observeSyncFileOperations(fs) {
const originals = new Map();
for (const name of ['statSync', 'statfsSync', 'existsSync', 'mkdirSync', 'openSync', 'readSync', 'readFileSync', 'writeSync', 'writeFileSync', 'appendFileSync', 'fsyncSync', 'renameSync', 'unlinkSync', 'readdirSync', 'truncateSync', 'closeSync']) {
if (typeof fs[name] !== 'function') continue;
const original = fs[name];
const monitor = this;
function measured(...args) {
const start = monitor.monotonic();
let failed = false;
try { return original.apply(this, args); }
catch (error) { failed = true; throw error; }
finally {
const durationMs = monitor.monotonic() - start;
if (durationMs >= 100) {
try {
monitor.record(`fs-sync.${name.toLowerCase()}`, durationMs, failed);
if (durationMs >= 1000) {
const caller = (new Error().stack || '').split('\n').slice(2)
.map(line => line.match(/([^/\\\s()]+\.js:\d+:\d+)\)?$/)?.[1]).find(Boolean) || null;
monitor.event('sync-file-delay', { operation: name, durationMs, failed, caller });
}
} catch {}
}
}
}
originals.set(name, { original, measured });
fs[name] = measured;
}
return () => {
for (const [name, { original, measured }] of originals) if (fs[name] === measured) fs[name] = original;
};
}
start({ version, getTransfers = () => null, pingRenderer = () => false } = {}) {
if (this.timer) return;
this.version = version;