From 464f3fbb74ed6ca07a89216cd83d9b88c4f72924 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sun, 1 Jan 2017 11:33:30 +0200 Subject: don't store whole job in stats allows job to be GC'd --- Gemfile.lock | 2 +- lib/oxidized/node/stats.rb | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ab52715..eda3963 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - oxidized (0.18.0) + oxidized (0.19.0) asetus (~> 0.1) net-ssh (~> 3.0.2) net-telnet diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb index 6b5719c..2f47419 100644 --- a/lib/oxidized/node/stats.rb +++ b/lib/oxidized/node/stats.rb @@ -6,14 +6,15 @@ module Oxidized # @param [Job] job job whose information add to stats # @return [void] def add job - stat = { - :start => job.start, - :end => job.end, - :time => job.time, + status = job.stats.dup + stat = { + :start => job.start.dup, + :end => job.end.dup, + :time => job.time.dup, } - @stats[job.status] ||= [] - @stats[job.status].shift if @stats[job.status].size > MAX_STAT - @stats[job.status].push stat + @stats[status] ||= [] + @stats[status].shift if @stats[status].size > MAX_STAT + @stats[status].push stat end # @param [Symbol] status stats for specific status -- cgit v1.2.1