From c045382479da3ec369e54bab678056cad804a343 Mon Sep 17 00:00:00 2001 From: Anton Aksola Date: Thu, 13 Mar 2014 17:38:49 +0200 Subject: modified worker to work on a node only once per interval --- lib/oxidized/worker.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/oxidized/worker.rb') diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb index fcdd6f0..a97e5da 100644 --- a/lib/oxidized/worker.rb +++ b/lib/oxidized/worker.rb @@ -13,6 +13,12 @@ module Oxidized ended.each { |job| process job } while @jobs.size < @jobs.want Log.debug "Jobs #{@jobs.size}, Want: #{@jobs.want}" + # ask for next node in queue non destructive way + nextnode = @nodes.first + unless nextnode.last.nil? + break if nextnode.last.end + CFG.interval > Time.now.utc + end + # shift nodes and get the next node node = @nodes.get node.running? ? next : node.running = true @jobs.push Job.new node -- cgit v1.2.1