log each repo's worker rss and peak, and how many workers a render started, so recycles show in the summary
Signed-off-by: dawn <90008@klbr.net>
197 unmodified linesExpand all19819920020120220220320420520620620720820921021141 unmodified lines25325425525625625725825926026123 unmodified lines28528628728828929029129229321 unmodified lines31531631731831731831932032132232327 unmodified lines197 unmodified linesExpand all const plan = queue.splice(distinctIdx !== -1 ? distinctIdx : 0, 1)[0]; activeFamilies.add(familyOf(plan)); return plan; }; // workers: the processes the render started, so each one past --workers is a recycle const totals = { rendered: 0, kept: 0, dropped: 0, over_budget: 0, pages: 0, bytes: 0, reads: 0 }; const totals = { rendered: 0, kept: 0, dropped: 0, over_budget: 0, pages: 0, bytes: 0, reads: 0, workers: 0 }; const failures = []; await Promise.all( Array.from({ length: workers }, () => runWorkerLoop(children, queue, takePlan, activeFamilies, familyOf, { hookPath, out, budget }, async (plan, result, wallMs) => { runWorkerLoop(children, queue, takePlan, activeFamilies, familyOf, { hookPath, out, budget, totals }, async (plan, result, wallMs) => { if (plan.owner) { const { did, prefix } = plan.owner; if (result.error) { failures.push(did);41 unmodified lines await writeStatus(summary); process.stdout.write(JSON.stringify({ ...summary, repos: status.repos, owners: status.owners }) + "\n", () => process.exit(failures.length === 0 ? 0 : 1));}
async function runWorkerLoop(children, queue, takePlan, activeFamilies, familyOf, { hookPath, out, budget }, onRepoDone) {async function runWorkerLoop(children, queue, takePlan, activeFamilies, familyOf, { hookPath, out, budget, totals }, onRepoDone) { const maxRepos = Math.max(1, Number(opts["worker-max-repos"]) || 12); const maxRssMb = Math.max(128, Number(opts["worker-max-rss-mb"]) || (process.versions.bun ? 360 : 650)); let lastFamily = null; while (queue.length > 0) {23 unmodified lines : []) ] }); children.add(child); totals.workers++; await new Promise((resolve) => { let current = null; let tStart = 0; let served = 0;21 unmodified lines const fam = familyOf(finished); const hasSameFamilyNext = queue.some((p) => familyOf(p) === fam); if (!hasSameFamilyNext) activeFamilies.delete(fam); const rssMb = message.rss_mb ?? 0; const { rss_mb: _rss, ...cleanMessage } = message; await onRepoDone(finished, cleanMessage, wallMs); await onRepoDone(finished, message, wallMs); const recycle = message.error || served >= maxRepos || rssMb >= (hasSameFamilyNext ? maxRssMb * 1.25 : maxRssMb);27 unmodified lines638 unmodified linesExpand all63964064164264364364464564664764864965069 unmodified lines638 unmodified linesExpand all read_ms: Math.round(reads.ms), ...stats, render_ms: Math.round(stats.render_ms), heap_peak_mb: Math.round(heapPeak / 1_048_576), rss_mb: Math.round(process.memoryUsage().rss / 1_048_576) rss_mb: Math.round(process.memoryUsage().rss / 1_048_576), // the worker's peak since it started, so the repo it jumps on is the one that spiked. // KiB, but bun on macos passes the kernel's bytes through max_rss_mb: Math.round(process.resourceUsage().maxRSS / (process.versions.bun && process.platform === "darwin" ? 1_048_576 : 1024)) };};
// a user's page: their profile and the repos this knot hosts for them, at the url of the69 unmodified lines