Autoscale based on core count - warvox - Unnamed repository; edit this file 'de… | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit d0dca3e175ddfcafb62c2a6587696be3e731ab11 | |
parent 14dda8a60d3172d24799205e1c6a0dd44ae6e910 | |
Author: HD Moore <[email protected]> | |
Date: Fri, 28 Dec 2012 11:46:59 -0600 | |
Autoscale based on core count | |
Diffstat: | |
M lib/warvox/config.rb | 9 ++++++--- | |
1 file changed, 6 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/lib/warvox/config.rb b/lib/warvox/config.rb | |
@@ -40,10 +40,13 @@ module Config | |
end | |
def self.analysis_threads | |
+ core_count = File.read("/proc/cpuinfo").scan(/^processor\s+:/)… | |
+ | |
info = YAML.load_file(WarVOX::Conf) | |
- return 1 if not info | |
- return 1 if not info['analysis_threads'] | |
- [ info['analysis_threads'].to_i, 1 ].max | |
+ return core_count if not info | |
+ return core_count if not info['analysis_threads'] | |
+ return core_count if info['analysis_threads'] == 0 | |
+ [ info['analysis_threads'].to_i, core_count ].min | |
end | |
def self.blacklist_path |