Module: HireFire::Macro::Deprecated::GoodJob
- Included in:
- GoodJob
- Defined in:
- lib/hirefire/macro/deprecated/good_job.rb
Overview
Provides backward compatibility with the deprecated GoodJob macro. For new implementations, refer to GoodJob.
Instance Method Summary collapse
-
#queue(*queues) ⇒ Integer
Retrieves the total number of jobs in the specified queue(s) using GoodJob.
Instance Method Details
#queue(*queues) ⇒ Integer
Retrieves the total number of jobs in the specified queue(s) using GoodJob.
This method queries the PostgreSQL database through GoodJob. It’s capable of counting jobs across different queues or all queues if none specified. The method checks for the existence of ::GoodJob::Execution or ::GoodJob::Job to determine the base class to use for querying.
23 24 25 26 27 28 |
# File 'lib/hirefire/macro/deprecated/good_job.rb', line 23 def queue(*queues) base_class = defined?(::GoodJob::Execution) ? ::GoodJob::Execution : ::GoodJob::Job scope = base_class.only_scheduled.unfinished scope = scope.where(queue_name: queues) if queues.any? scope.count end |