Skip to content

Commit

Permalink
Merge pull request #18 from ThePooN/hotfix-pr-17
Browse files Browse the repository at this point in the history
πŸš‘ Fix crash following the merge of PR #17
  • Loading branch information
nanaya committed Oct 17, 2023
2 parents 28d304d + f672715 commit 5e7d7f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scthumbd.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ const thumber = scThumber({
const workers = process.env.WORKERS ?? os.cpus().length;
const port = process.env.PORT ?? 4001;

if (cluster.isPrimary && workers > 1) {
if (cluster.isPrimary) {
console.log(`${'[m]'.red} ${'scthumbd %s'.yellow}`, process.env.npm_package_version);
console.log(`${'[m]'.red} Listening on port ${'%s'.green}...`, port);
console.log(`${'[m]'.red} Starting ${'%s'.green} workers...`, workers);
}

if (cluster.isPrimary && workers > 1) {
console.log(`${'[m]'.red} Starting ${'%s'.green} workers...`, workers);
for (let i = 0; i < workers; i++) {
cluster.fork();
}
Expand All @@ -81,5 +83,5 @@ if (cluster.isPrimary && workers > 1) {

app.listen(port);

console.log(`${'[w]'.magenta} Worker ${'%s'.green} started...`, cluster.worker.id);
console.log(`${'[w]'.magenta} Worker ${'%s'.green} started...`, cluster.worker?.id ?? 1);
}

0 comments on commit 5e7d7f4

Please sign in to comment.