Skip to content

Commit

Permalink
Change default concurrency level in Node.js to match Ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinson committed Jan 21, 2015
1 parent 29580ee commit 3e713e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/nodejs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ connection strings:
// mongo: 'mongodb://localhost:27017/test'
// postgres: 'postgres://localhost:5432/' + process.env.USER
},
worker_procs: 0
worker_procs: 1
});
The Node.js version of the API server can use any of five different databases
Expand Down
20 changes: 10 additions & 10 deletions src/node-app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//- server.js ~~
// ~~ (c) SRW, 06 Oct 2012
// ~~ last updated 20 Jan 2015
// ~~ last updated 21 Jan 2015

(function () {
'use strict';
Expand All @@ -14,9 +14,9 @@
/*jslint indent: 4, maxlen: 80, node: true */

/*properties
cpus, enable_api_server, enable_cors, enable_web_server, env,
launch_service, length, mongo, parse, persistent_storage,
static_content, QM_API_STRING, QM_WEB_STRING, TRAVIS, worker_procs
enable_api_server, enable_cors, enable_web_server, env, launch_service,
mongo, parse, persistent_storage, static_content, QM_API_STRING,
QM_WEB_STRING, TRAVIS, worker_procs
*/

// Declarations
Expand Down Expand Up @@ -49,13 +49,13 @@
}

if (process.env.TRAVIS === 'true') {
// This is for use with Travis CI. On their original infrastructure, the
// VMs run on 1.5 cores with burst capacity, so it was best to set
// `options.worker_procs = 1`. The new infrastructure, based on Docker
// containers, offers 2 dedicated cores, but ... see http://goo.gl/6x9Df6.
// This is for use with running the unit tests on Travis CI. On their
// original infrastructure, the VMs run on 1.5 cores with burst capacity,
// so it was best to set `options.worker_procs = 1`. The new
// infrastructure, based on Docker containers, offers 2 dedicated cores,
// but ... see http://goo.gl/6x9Df6. QM defaults to 1 anyway, but there's
// no harm in setting it explicitly.
options.worker_procs = 1;
} else {
options.worker_procs = require('os').cpus().length;
}

qm.launch_service(options);
Expand Down
2 changes: 1 addition & 1 deletion src/npm-module
Submodule npm-module updated 1 files
+2 −2 lib/service.js

0 comments on commit 3e713e6

Please sign in to comment.