summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bryant <m@ocado.com>2016-01-27 14:46:58 +0000
committerMike Bryant <m@ocado.com>2016-01-27 14:46:58 +0000
commit071ba09110fccd845995a9eecdf35e544662daf1 (patch)
tree74d414aaf24073f95d9dd36a547ad0b40805c7b4
parent8cef62390cdfbff723e2d6b99fd92157406e17d5 (diff)
Sort the nodes by last update on reload
Reloading sets the node queue to the original order. If Oxidized was restarted, collected a couple of nodes, and was then reloaded, the new queue would have a node with a recent last end time. Thus, no new nodes would be collected until the first one passed its interval. Here the nodes are sorted on reload, to maintain the queue invariant.
-rw-r--r--lib/oxidized/nodes.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb
index 0c02d7a..61d2d44 100644
--- a/lib/oxidized/nodes.rb
+++ b/lib/oxidized/nodes.rb
@@ -147,6 +147,7 @@ module Oxidized
rescue Oxidized::NodeNotFound
end
end
+ sort_by! { |x| x.last.nil? ? Time.new(0) : x.last.end }
end
public