Class: Sidekiq::PrioritizedQueues::Middleware
- Inherits:
-
Object
- Object
- Sidekiq::PrioritizedQueues::Middleware
- Defined in:
- lib/sidekiq/prioritized_queues/middleware.rb
Instance Method Summary collapse
Instance Method Details
#call(worker_class, msg, queue, redis_pool) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sidekiq/prioritized_queues/middleware.rb', line 4 def call(worker_class, msg, queue, redis_pool) klass = case worker_class when String then worker_class.constantize else worker_class end priority = klass.['priority'] msg['priority'] = case priority when Proc then priority.call(*msg['args']) when String then priority.to_i when Fixnum then priority else Time.now.to_f end yield end |