Class: Dynamiq::Fetcher
- Inherits:
-
Object
- Object
- Dynamiq::Fetcher
- Defined in:
- lib/dynamiq/fetcher.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #queues ⇒ Object
- #retrieve_work ⇒ Object
Constructor Details
#initialize(options) ⇒ Fetcher
Returns a new instance of Fetcher.
3 4 5 |
# File 'lib/dynamiq/fetcher.rb', line 3 def initialize() @strictly_ordered_queues = !![:strict] end |
Class Method Details
.bulk_requeue(inprogress, options) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/dynamiq/fetcher.rb', line 15 def self.bulk_requeue(inprogress, ) return if inprogress.empty? inprogress.each(&:requeue) Sidekiq.logger.debug { "Re-queueing terminated jobs" } Sidekiq.logger.debug { "J/K NOT REALLY" } end |
Instance Method Details
#queues ⇒ Object
11 12 13 |
# File 'lib/dynamiq/fetcher.rb', line 11 def queues @strictly_ordered_queues ? Queue.all : Queue.all.shuffle.uniq end |
#retrieve_work ⇒ Object
7 8 9 |
# File 'lib/dynamiq/fetcher.rb', line 7 def retrieve_work queues.each { |queue| job = queue.pop and return job } end |