class Resque::Pool

Resque Pool monkey patched methods for resque-pool

Public Class Methods

run() click to toggle source

add the running pool to distributed pool in order to manipulate it

# File lib/resque/pool/patches.rb, line 7
def self.run
  if GC.respond_to?(:copy_on_write_friendly=)
    GC.copy_on_write_friendly = true
  end
  pool_config = Resque::Cluster.config ? {} : choose_config_file
  started_pool = Resque::Pool.new(pool_config).start
  Resque::Cluster.init(started_pool) if Resque::Cluster.config
  started_pool.join
  Resque::Cluster.member.unregister if Resque::Cluster.member
end

Public Instance Methods

adjust_worker_counts(worker, number) click to toggle source
# File lib/resque/pool/patches.rb, line 34
def adjust_worker_counts(worker, number)
  over_adjustment = ''
  if @config[worker].to_i + number < 0
    over_adjustment = "#{worker}:#{@config[worker].to_i + number}"
    @config[worker] = 0
  else
    @config[worker] = @config[worker].to_i + number
  end
  over_adjustment
end
cluster_update() click to toggle source
# File lib/resque/pool/patches.rb, line 30
def cluster_update
  Resque::Cluster.member.perform if Resque::Cluster.member
end
premature_quit() click to toggle source
# File lib/resque/pool/patches.rb, line 25
def premature_quit
  log "Quiting ..."
  Process.kill(:QUIT, Process.pid)
end