Class: Fragmentary::SendRequestsJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Fragmentary::SendRequestsJob
- Defined in:
- lib/fragmentary/jobs/send_requests_job.rb
Instance Method Summary collapse
- #perform(queue, delay: nil, between: nil, queue_suffix: '', priority: 0) ⇒ Object
- #schedule_next ⇒ Object
Instance Method Details
#perform(queue, delay: nil, between: nil, queue_suffix: '', priority: 0) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/fragmentary/jobs/send_requests_job.rb', line 9 def perform(queue, delay: nil, between: nil, queue_suffix: '', priority: 0) @queue = queue @delay = delay @between = between @queue_suffix = queue_suffix @priority = priority @between ? @queue.send_next_request : @queue.send_all_requests end |
#schedule_next ⇒ Object
18 19 20 21 22 |
# File 'lib/fragmentary/jobs/send_requests_job.rb', line 18 def schedule_next if @queue.size > 0 self.enqueue(:wait => @between, :queue => @queue.target.queue_name + @queue_suffix, :priority => @priority) end end |