summaryrefslogtreecommitdiff
path: root/lib/oxidized
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 /lib/oxidized
parent0c40612f8880eb8921c26c9862fe20521d0843e3 (diff)
don't store whole job in stats
allows job to be GC'd
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/node/stats.rb15
1 files changed, 8 insertions, 7 deletions
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