From: kuro5hin Date: Tue, 18 Apr 2017 13:58:22 +0000 (-0400) Subject: Fix streaming server worker count (#2082) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=0790aa91659cb6f839649d59e8ef65375dfff5eb;p=mastodon.git 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. --- 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) => {