@lingui/cli
Version:
Lingui CLI to extract messages, compile catalogs, and manage translation workflows
16 lines (15 loc) • 505 B
JavaScript
import * as os from "node:os";
export function resolveWorkersOptions(opts) {
const cores = os.availableParallelism();
if (Number(opts.workers) <= 1 || cores === 1) {
return { poolSize: 0 };
}
if (!opts.workers) {
if (cores <= 2) {
return { poolSize: cores }; // on tiny machines, use all
}
// on big machines cap to 8, to avoid trashing
return { poolSize: Math.min(cores - 1, 8) };
}
return { poolSize: Number(opts.workers) };
}