Module: HireFire::Macro::Deprecated::Sidekiq
- Included in:
- Sidekiq
- Defined in:
- lib/hirefire/macro/deprecated/sidekiq.rb
Overview
Provides backward compatibility with the deprecated Sidekiq macro. For new implementations, refer to Sidekiq.
Instance Method Summary collapse
-
#latency(queue = "default") ⇒ Float
Calculates the latency (in seconds) for the specified Sidekiq queue.
-
#queue(*args) ⇒ Integer
Counts the number of jobs in the specified Sidekiq queue(s).
Instance Method Details
#latency(queue = "default") ⇒ Float
Calculates the latency (in seconds) for the specified Sidekiq queue.
The method uses the Sidekiq::Queue class to obtain the latency of a queue, which is the duration since the oldest job in the queue was enqueued.
21 22 23 |
# File 'lib/hirefire/macro/deprecated/sidekiq.rb', line 21 def latency(queue = "default") ::Sidekiq::Queue.new(queue.to_s).latency end |
#queue(*args) ⇒ Integer
Counts the number of jobs in the specified Sidekiq queue(s).
The method supports various options to include or exclude jobs from specific sets like scheduled, retries, or in-progress jobs.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/hirefire/macro/deprecated/sidekiq.rb', line 46 def queue(*args) require "sidekiq/api" args.flatten! = args.last.is_a?(Hash) ? args.pop : {} queues = args.map(&:to_s) all_queues = ::Sidekiq::Queue.all.map(&:name) queues = all_queues if queues.empty? if fast_lookup_capable?(queues, all_queues) fast_lookup() else dynamic_lookup(queues, ) end end |