Module: HireFire::Backend::DelayedJob::Mongoid
- Defined in:
- lib/hirefire/backend/delayed_job/mongoid.rb
Instance Method Summary collapse
-
#jobs ⇒ Fixnum
Counts the amount of queued jobs in the database, failed jobs and jobs scheduled for the future are excluded.
-
#working ⇒ Fixnum
Counts the amount of jobs that are locked by a worker There is no other performant way to determine the amount of workers there currently are.
Instance Method Details
#jobs ⇒ Fixnum
Counts the amount of queued jobs in the database, failed jobs and jobs scheduled for the future are excluded
13 14 15 16 17 18 |
# File 'lib/hirefire/backend/delayed_job/mongoid.rb', line 13 def jobs ::Delayed::Job.where( :failed_at => nil, :run_at.lte => Time.now ).count end |
#working ⇒ Fixnum
Counts the amount of jobs that are locked by a worker There is no other performant way to determine the amount of workers there currently are
26 27 28 29 |
# File 'lib/hirefire/backend/delayed_job/mongoid.rb', line 26 def working ::Delayed::Job. where(:locked_by.ne => nil).count end |