Sha256: 476c6cc41ce8babf8990552c5eab824a202bcde72eb4efa4ebddaceaab74db43

Contents?: true

Size: 495 Bytes

Versions: 2

Compression:

Stored size: 495 Bytes

Contents

module Resque
  class EmptyQueueRetryJob
    @queue = :resque_empty_queue

    def self.perform(empty_queue_job_class_name, *args)
      klass = eval(empty_queue_job_class_name)
      if queue_is_empty?(klass)
        Resque.enqueue(klass, *args)
      else
        # TODO: use resque-scheduler to enqueue in the future
        Resque.enqueue_in(5, self, klass.name, *args)
      end
    end

    def self.queue_is_empty?(klass)
      return Resque.size(klass.queue_name) == 0
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resque_empty_queue-0.0.2 lib/resque/empty_queue_retry_job.rb
resque_empty_queue-0.0.1 lib/resque/empty_queue_retry_job.rb