about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorkuro5hin <rusty@kuro5hin.org>2017-04-18 09:58:22 -0400
committerEugen <eugen@zeonfederated.com>2017-04-18 15:58:22 +0200
commit0790aa91659cb6f839649d59e8ef65375dfff5eb (patch)
tree3d6afb621c3e19088404d23ad33c698fe6f22cc7 /streaming
parente2a1b574ab4ec5dd07dbc5c317bcc3718f13c19b (diff)
Fix streaming server worker count (#2082)
* Make sure we start at least one streaming worker, even if there's only one CPU and we're in production mode.

* Oops, let's make sure we're counting cpus right too.
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 366a39a6a..5e25085c2 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -19,7 +19,7 @@ dotenv.config({
 if (cluster.isMaster) {
   // cluster master
 
-  const core = +process.env.STREAMING_CLUSTER_NUM || (env === 'development' ? 1 : os.cpus().length - 1)
+  const core = +process.env.STREAMING_CLUSTER_NUM || (env === 'development' ? 1 : (os.cpus().length > 1 ? os.cpus().length - 1 : 1))
   const fork = () => {
     const worker = cluster.fork();
     worker.on('exit', (code, signal) => {