Module: HireFire::Macro::Que
Constant Summary collapse
- QUERY =
%{ SELECT count(*) AS total FROM que_jobs WHERE run_at < now() }.freeze
Instance Method Summary collapse
-
#queue(queue = nil) ⇒ Integer
Queries the PostgreSQL database through Que in order to count the amount of jobs in the specified queue.
Instance Method Details
#queue(queue = nil) ⇒ Integer
Queries the PostgreSQL database through Que in order to count the amount of jobs in the specified queue.
22 23 24 25 26 |
# File 'lib/hirefire/macro/que.rb', line 22 def queue(queue = nil) query = queue ? "#{QUERY} AND queue = '#{queue}'" : QUERY results = ::Que.execute(query).first results["total"].to_i end |