Module: Resque::Plugins::EmptyQueueJob
- Defined in:
- lib/resque/plugins/empty_queue_job.rb
Instance Method Summary collapse
- #before_perform_empty_queue_job(*args) ⇒ Object
- #queue ⇒ Object
- #queue_name ⇒ Object
- #wait_for_empty_queue(queue_name) ⇒ Object
Instance Method Details
#before_perform_empty_queue_job(*args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/resque/plugins/empty_queue_job.rb', line 19 def before_perform_empty_queue_job(*args) if !failure_queue_empty? # should this re-enqueue itself or simply continue to retry raise EmptyQueueFailureDetectedError.new("Failure detected in queue: #{queue_name}. Retry after jobs placed in queue.") end if !job_queue_empty? || !working_queue_empty? # try again later Resque.enqueue_in(5, self, *args) raise Resque::Job::DontPerform end end |
#queue ⇒ Object
7 8 9 |
# File 'lib/resque/plugins/empty_queue_job.rb', line 7 def queue :empty_queue end |
#queue_name ⇒ Object
15 16 17 |
# File 'lib/resque/plugins/empty_queue_job.rb', line 15 def queue_name return @queue_name end |
#wait_for_empty_queue(queue_name) ⇒ Object
11 12 13 |
# File 'lib/resque/plugins/empty_queue_job.rb', line 11 def wait_for_empty_queue(queue_name) @queue_name = queue_name end |