Autoscale based on core count - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit d0dca3e175ddfcafb62c2a6587696be3e731ab11
(DIR) parent 14dda8a60d3172d24799205e1c6a0dd44ae6e910
(HTM) Author: HD Moore <hd_moore@rapid7.com>
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(-)
---
(DIR) 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+:/).length rescue 1
+
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