mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-20 04:59:34 +01:00
fix(header): the two review items of #824
The format check passes again (Prettier breaks the createCpuUsageMeter call one argument per line), and the load-average fallback answers 0 instead of dividing by a core count of 0 on the platform it exists for, where cpus() is empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6a5b818f65
commit
9d0f29fb22
1 file changed
+6
-2
@@ -95,8 +95,12 @@ const SCREENSHOTS_DIR = dataPath('screenshots');
|
||||
const CPU_COUNT = cpus().length;
|
||||
|
||||
/** Header CPU use; the 1-minute load average per core only when the platform reports no core times. */
|
||||
const cpuUsagePercent = createCpuUsageMeter(cpus, () => performance.now(), () =>
|
||||
Math.min(100, Math.round((loadavg()[0] / CPU_COUNT) * 100))
|
||||
const cpuUsagePercent = createCpuUsageMeter(
|
||||
cpus,
|
||||
() => performance.now(),
|
||||
() =>
|
||||
// That is also the platform where cpus() is empty, so CPU_COUNT can be 0 here.
|
||||
CPU_COUNT > 0 ? Math.min(100, Math.round((loadavg()[0] / CPU_COUNT) * 100)) : 0
|
||||
);
|
||||
|
||||
function parseOptionalNumber(value: string | undefined): number | undefined {
|
||||
|
||||
Reference in new issue
Block a user