diff options
Diffstat (limited to 'lib/oxidized/jobs.rb')
-rw-r--r-- | lib/oxidized/jobs.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/oxidized/jobs.rb b/lib/oxidized/jobs.rb index ff7f92b..2c656f6 100644 --- a/lib/oxidized/jobs.rb +++ b/lib/oxidized/jobs.rb @@ -20,13 +20,18 @@ module Oxidized end def duration last + if @durations.size > @nodes.size + @durations.slice! @nodes.size...@durations.size + elsif @durations.size < @nodes.size + @durations.fill AVERAGE_DURATION, @durations.size...@nodes.size + end @durations.push(last).shift @duration = @durations.inject(:+).to_f / @nodes.size #rolling average new_count end def new_count - @want = ((@nodes.size * @duration) / @interval).to_i + @want = ((@nodes.size * @duration) / @interval).ceil @want = 1 if @want < 1 @want = @nodes.size if @want > @nodes.size @want = @max if @want > @max |