diff options
Diffstat (limited to 'lib/oxidized/worker.rb')
-rw-r--r-- | lib/oxidized/worker.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb index 324dcb5..1952d01 100644 --- a/lib/oxidized/worker.rb +++ b/lib/oxidized/worker.rb @@ -14,17 +14,21 @@ module Oxidized ended.each { |job| process job } @jobs.work while @jobs.size < @jobs.want - Oxidized.logger.debug "Jobs #{@jobs.size}, Want: #{@jobs.want}" + Oxidized.logger.debug "lib/oxidized/worker.rb: 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 + Oxidized.config.interval > Time.now.utc + # Set unobtainable value for 'last' if interval checking is disabled + last = Oxidized.config.interval == 0 ? Time.now.utc + 10 : nextnode.last.end + break if last + Oxidized.config.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 + Oxidized.logger.debug "lib/oxidized/worker.rb: Added #{node.name} to the job queue" end + Oxidized.logger.debug("lib/oxidized/worker.rb: #{@jobs.size} jobs running in parallel") unless @jobs.empty? end def process job |