@teamscala/service-boot 0.23.337 → 0.23.338
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
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
import { rm, readdir, stat } from "node:fs/promises";
|
|
43
43
|
import { readdirSync, type Dirent } from "node:fs";
|
|
44
44
|
import { join } from "node:path";
|
|
45
|
-
import { spawnSync } from "@teamscala/os/spawn/spawn";
|
|
46
45
|
import { userHome, workspaceRoot } from "@teamscala/os/host-paths";
|
|
47
46
|
import { formatBytes } from "@teamscala/formatters/format-bytes";
|
|
48
47
|
import { recordEvent } from "@teamscala/event-log/record-event";
|
|
@@ -290,33 +289,6 @@ async function sweepHostCache(ctx: {
|
|
|
290
289
|
},
|
|
291
290
|
});
|
|
292
291
|
|
|
293
|
-
// Disk-threshold monitor — piggybacks on this nightly sweep event (no separate
|
|
294
|
-
// interval/infra: `guards-never-run-on-interval`). If `/` usage crosses the
|
|
295
|
-
// configured threshold, emit `host.disk.high` (-> event-log/GlitchTip) so a fill
|
|
296
|
-
// the sweep can't absorb (external dump, runaway log) is caught within a day.
|
|
297
|
-
const highPercent = 90;
|
|
298
|
-
try {
|
|
299
|
-
const dfRes = spawnSync({ name: "df:/", command: ["df", "--output=pcent,target"], timeoutMs: 5000 });
|
|
300
|
-
const dfOut = (dfRes.stdout ?? "").trim();
|
|
301
|
-
const rootLine = dfOut
|
|
302
|
-
.split("\n")
|
|
303
|
-
.find((l) => l.trim().endsWith("/"));
|
|
304
|
-
const pctMatch = rootLine?.match(/(\d+)%/);
|
|
305
|
-
if (pctMatch) {
|
|
306
|
-
const usePct = Number(pctMatch[1]);
|
|
307
|
-
if (usePct >= highPercent) {
|
|
308
|
-
log.warn(
|
|
309
|
-
`[host-cache-sweep] disk usage ${usePct}% >= ${highPercent}% threshold — emitting host.disk.high`,
|
|
310
|
-
);
|
|
311
|
-
recordEvent({
|
|
312
|
-
kind: "host.disk.high",
|
|
313
|
-
payload: { usePct, threshold: highPercent, df: dfOut, completedAt: new Date().toISOString() },
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
} catch (error) {
|
|
318
|
-
log.warn(`[host-cache-sweep] disk-threshold check failed: ${String(error)}`);
|
|
319
|
-
}
|
|
320
292
|
}
|
|
321
293
|
|
|
322
294
|
pgBossHandlerRegistry.register(
|