Module: HireFire::Macro::Qu

Extended by:
Qu
Included in:
Qu
Defined in:
lib/hirefire/macro/qu.rb

Instance Method Summary collapse

Instance Method Details

#queue(*queues) ⇒ Integer

Counts the amount of jobs in the (provided) Qu queue(s).

Examples:

Qu Macro Usage

HireFire::Macro::Qu.queue # all queues
HireFire::Macro::Qu.queue("email") # only email queue
HireFire::Macro::Qu.queue("audio", "video") # audio and video queues

Parameters:

  • queues (Array)

    provide one or more queue names, or none for “all”.

Returns:

  • (Integer)

    the number of jobs in the queue(s).



18
19
20
21
# File 'lib/hirefire/macro/qu.rb', line 18

def queue(*queues)
  queues = ::Qu.backend.queues if queues.empty?
  queues.flatten.inject(0) { |memo, queue| memo += ::Qu.backend.length(queue); memo }
end