Skip to content

Commit

Permalink
Auto-detect CPU count in test apps
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinson committed Jan 24, 2015
1 parent 2d98fdb commit dada233
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/node-app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
/*jslint indent: 4, maxlen: 80, node: true */

/*properties
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
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
*/

// Declarations
Expand All @@ -38,7 +38,7 @@
persistent_storage: {
mongo: 'mongodb://localhost:27017/test'
},
worker_procs: 2
worker_procs: require('os').cpus().length
};

qm = require('qm');
Expand Down
1 change: 1 addition & 0 deletions src/ruby-app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ from_git = {
git: 'https://github.com/qmachine/qm-ruby.git'
}

gem 'facter'
gem 'json'
gem 'qm', (FileTest.directory?(from_dir[:path]) ? from_dir : from_git)

Expand Down
4 changes: 2 additions & 2 deletions src/ruby-app/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# See https://docs.qmachine.org/en/latest/ruby.html for more information.
#
# ~~ (c) SRW, 24 Apr 2013
# ~~ last updated 23 Jan 2015
# ~~ last updated 24 Jan 2015

require 'rubygems'
require 'bundler'
Expand All @@ -22,7 +22,7 @@
persistent_storage: {
mongo: 'mongodb://localhost:27017/test'
},
worker_procs: 2
worker_procs: Facter.value('ProcessorCount')
}

if (ENV['QM_API_STRING']) then
Expand Down
2 changes: 1 addition & 1 deletion src/ruby-gem
Submodule ruby-gem updated 1 files
+14 −9 lib/qm.rb

0 comments on commit dada233

Please sign in to comment.