Skip to content

Commit

Permalink
fix(compiler@other): 🧵 default to 4 threads when there is no availabl…
Browse files Browse the repository at this point in the history
…e CPU info

This fix is for Termux Android when os.cpus() is not giving any CPU info. os.cpu() works but only ran on proot-distro.
  • Loading branch information
TBroz15 committed Sep 20, 2024
1 parent f967f95 commit e4b7eb4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import type {
PNGOptions,
} from "./config/config.d.ts";

const threads = cpus().length;
const availCPUs = cpus().length;
const threads = availCPUs === 0 ? 4 : availCPUs;

interface FinalStats {
compileTime: number;
Expand Down

0 comments on commit e4b7eb4

Please sign in to comment.