summaryrefslogtreecommitdiff
path: root/lib/oxidized/worker.rb
diff options
context:
space:
mode:
authorFlorian Hibler <fhibler@users.noreply.github.com>2015-02-26 16:47:18 +0000
committerFlorian Hibler <fhibler@users.noreply.github.com>2015-02-26 16:47:18 +0000
commit1c85b3202033ed965abe16e15688f0b0025561ea (patch)
tree4ea9288b7a3dc774a60cdbd096761df4da147f8e /lib/oxidized/worker.rb
parent19de2ac51cd765e1c7b7fe731759fb50086675b5 (diff)
parentdb165b5e1ebb3091a49029d739b68a913bc75db6 (diff)
Merge pull request #1 from ytti/master
Merge to latest
Diffstat (limited to 'lib/oxidized/worker.rb')
-rw-r--r--lib/oxidized/worker.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb
index e274e1e..7ed70ac 100644
--- a/lib/oxidized/worker.rb
+++ b/lib/oxidized/worker.rb
@@ -7,10 +7,12 @@ module Oxidized
@jobs = Jobs.new CFG.threads, CFG.interval, @nodes
Thread.abort_on_exception = true
end
+
def work
ended = []
@jobs.delete_if { |job| ended << job if not job.alive? }
ended.each { |job| process job }
+ @jobs.work
while @jobs.size < @jobs.want
Log.debug "Jobs #{@jobs.size}, Want: #{@jobs.want}"
# ask for next node in queue non destructive way
@@ -24,6 +26,7 @@ module Oxidized
@jobs.push Job.new node
end
end
+
def process job
node = job.node
node.last = job
@@ -49,6 +52,9 @@ module Oxidized
end
Log.warn msg
end
+ rescue NodeNotFound
+ Log.warn "#{node.name} not found, removed while collecting?"
end
+
end
end