summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2018-06-12 00:30:15 +0300
committerSaku Ytti <saku@ytti.fi>2018-06-12 00:30:15 +0300
commitf9c5f300e46e786de95abcb5bbaa7ae6cedd588a (patch)
tree78cb0ea81a5afb19c2b3c29d32821c8c80612942
parent5df10b5a6880747a9f659905dd7b4b75f338c8bb (diff)
add mtime and bump up version
Fixes performance regression
-rw-r--r--lib/oxidized/node.rb5
-rw-r--r--lib/oxidized/node/stats.rb6
-rw-r--r--lib/oxidized/version.rb4
-rw-r--r--lib/oxidized/worker.rb1
4 files changed, 14 insertions, 2 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index 3c32b8e..300221e 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -95,6 +95,7 @@ module Oxidized
:model => @model.class.to_s,
:last => nil,
:vars => @vars,
+ :mtime => @stats.mtime,
}
h[:full_name] = [@group, @name].join('/') if @group
if @last
@@ -126,6 +127,10 @@ module Oxidized
@retry = 0
end
+ def modified
+ @stats.update_mtime
+ end
+
private
def resolve_prompt opt
diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb
index 0778d6d..fbc2cf7 100644
--- a/lib/oxidized/node/stats.rb
+++ b/lib/oxidized/node/stats.rb
@@ -1,6 +1,7 @@
module Oxidized
class Node
class Stats
+ attr_accessor :mtime
MAX_STAT = 10
# @param [Job] job job whose information add to stats
@@ -35,9 +36,14 @@ module Oxidized
@stats[:counter].reduce(0) { |m, h| h[0] == :success ? m : m + h[1] }
end
+ def update_mtime
+ @mtime = Time.now.utc
+ end
+
private
def initialize
+ @mtime = "unknown"
@stats = {}
@stats[:counter] = Hash.new 0
end
diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb
index 397ae5e..4b710ef 100644
--- a/lib/oxidized/version.rb
+++ b/lib/oxidized/version.rb
@@ -1,6 +1,6 @@
module Oxidized
- VERSION = '0.22.0'
- VERSION_FULL = '0.22.0-10-ge8bee7b'
+ VERSION = '0.23.0'
+ VERSION_FULL = '0.23.0'
def self.version_set
version_full = %x(git describe --tags).chop rescue ""
version = %x(git describe --tags --abbrev=0).chop rescue ""
diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb
index 5d5fc01..74b046d 100644
--- a/lib/oxidized/worker.rb
+++ b/lib/oxidized/worker.rb
@@ -53,6 +53,7 @@ module Oxidized
output = node.output.new
if output.store node.name, job.config,
:msg => msg, :email => node.email, :user => node.user, :group => node.group
+ node.modified
Oxidized.logger.info "Configuration updated for #{node.group}/#{node.name}"
Oxidized.Hooks.handle :post_store, :node => node,
:job => job,