import cluster from 'node:cluster'
import os from 'node:os'
import { env, log } from "./util";

if (cluster.isPrimary) {
    const n = Math.min(os.availableParallelism(), +env.MAX_WORKER_PROCESSES);
    log.info(`Starting ${n} worker processes`)
    for (let i = 0; i < n; i++)
        cluster.fork()
} else {
    await import('./server')
}
