summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/jobs.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/oxidized/jobs.rb b/lib/oxidized/jobs.rb
index 60a83f4..2c656f6 100644
--- a/lib/oxidized/jobs.rb
+++ b/lib/oxidized/jobs.rb
@@ -20,6 +20,11 @@ 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