Module: HireFire::Macro::SolidQueue
- Extended by:
- SolidQueue, Utility
- Included in:
- SolidQueue
- Defined in:
- lib/hirefire/macro/solid_queue.rb
Constant Summary collapse
- LATENCY_METHODS =
[ :ready_latency, :scheduled_latency, :blocked_latency ].freeze
- SIZE_METHODS =
[ :ready_size, :scheduled_size, :claimed_size, :blocked_size ].freeze
Instance Method Summary collapse
-
#job_queue_latency(*queues) ⇒ Float
Calculates the maximum job queue latency using SolidQueue.
-
#job_queue_size(*queues) ⇒ Integer
Calculates the total job queue size using SolidQueue.
Instance Method Details
#job_queue_latency(*queues) ⇒ Float
Calculates the maximum job queue latency using SolidQueue. If no queues are specified, it measures latency across all available queues.
This function measures the job queue latency across the Ready, Scheduled, and Blocked queues, based on the enqueue, schedule, and expiration times of their executions. Executions in the Claimed queue, as well as in paused queues, are excluded from the calculation.
33 34 35 36 37 38 39 |
# File 'lib/hirefire/macro/solid_queue.rb', line 33 def job_queue_latency(*queues) queues, now = determine_queues(queues), Time.now LATENCY_METHODS.map do |latency_method| method(latency_method).call(queues, now: now) end.max end |
#job_queue_size(*queues) ⇒ Integer
Calculates the total job queue size using SolidQueue. If no queues are specified, it measures size across all available queues.
This function measures the job queue latency across the Ready, Scheduled, Blocked, and Claimed queues, based on the schedule and expiration times of their executions. Executions in paused queues are excluded from the calculation.
66 67 68 69 70 71 72 |
# File 'lib/hirefire/macro/solid_queue.rb', line 66 def job_queue_size(*queues) queues = determine_queues(queues) SIZE_METHODS.sum do |count_method| method(count_method).call(queues) end end |