Skip to content

Commit f6bb0c8

Browse files
committed
Make the number of workers configurable through WEB_CONCURRENCY
https://devcenter.heroku.com/articles/node-memory-use#running-multiple-processes
1 parent c8dc423 commit f6bb0c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fastboot.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
'use strict';
44

55
const fs = require('fs');
6+
const os = require('os');
67
const FastBootAppServer = require('fastboot-app-server');
78

89
// because fastboot-app-server uses cluster, but it might change in future
@@ -43,10 +44,15 @@ function writeAppInitializedWhenReady(logger) {
4344

4445
var logger = new LoggerWithoutTimestamp();
4546

47+
logger.writeLine(`${os.cpus().length} cores available`);
48+
49+
let workerCount = process.env.WEB_CONCURRENCY || 1;
50+
4651
let server = new FastBootAppServer({
4752
distPath: 'dist',
4853
port: 9000,
4954
ui: logger,
55+
workerCount: workerCount,
5056
});
5157

5258
if (!cluster.isWorker) {

0 commit comments

Comments
 (0)