summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2017-01-01 11:33:30 +0200
committerSaku Ytti <saku@ytti.fi>2017-01-01 11:33:30 +0200
commit464f3fbb74ed6ca07a89216cd83d9b88c4f72924 (patch)
tree16478300605b33785c636611eeb3ff09c5ee2354
parent0c40612f8880eb8921c26c9862fe20521d0843e3 (diff)
don't store whole job in stats
allows job to be GC'd
-rw-r--r--Gemfile.lock2
-rw-r--r--lib/oxidized/node/stats.rb15
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