Sha256: 1fa29d306d7cd89aa9c733018b25e994fe29afdd291aae0f04a1b9353458a2b6

Contents?: true

Size: 651 Bytes

Versions: 9

Compression:

Stored size: 651 Bytes

Contents

module Resqutils
  # Can be queued to kill a worker.  By default, will be queued to the 'worker_killer_job' queue, however
  # you can specify RESQUTILS_WORKER_KILLER_JOB_QUEUE in the environment to set an override.  Of course, you can always
  # forcibly enqueue it as needed.
  class WorkerKillerJob
    def self.queue
      @queue ||= begin
                   queue = String(ENV["RESQUTILS_WORKER_KILLER_JOB_QUEUE"]).strip
                   queue.length == 0 ? :worker_killer_job : queue
                 end
    end
    def self.perform(worker_id)
      Resque.workers.select { |_| _.id == worker_id }.each(&:unregister_worker)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
resqutils-1.3.4 lib/resqutils/worker_killer_job.rb
resqutils-1.3.3 lib/resqutils/worker_killer_job.rb
resqutils-1.3.2 lib/resqutils/worker_killer_job.rb
resqutils-1.3.1 lib/resqutils/worker_killer_job.rb
resqutils-1.3.0 lib/resqutils/worker_killer_job.rb
resqutils-1.2.1 lib/resqutils/worker_killer_job.rb
resqutils-1.2.0 lib/resqutils/worker_killer_job.rb
resqutils-1.1.1 lib/resqutils/worker_killer_job.rb
resqutils-1.1.0 lib/resqutils/worker_killer_job.rb