INNER CODE UNIT · TypeScript
maxWorkers
tcgdex/cards-database · server/src/index.ts:30
maxWorkers = Math.min(maxWorkers, parseInt(process.env.MAX_WORKERS))
}
// create the workers
console.log(`creating ${maxWorkers} workers...`)
for (let i = 0; i < maxWorkers; i++) {
cluster.fork()
}
cluster.on('online', (worker) => {
console.log('Worker', worker.id, 'online')
// handle sub processes
worker.on('message', async (command: Command) => {
switch (command.type) {
case 'getTCGPlayerPrice': {
worker.send({
// @ts-expect-error f*ck off