Module: Resque::Plugins::JobStats::Enqueued
- Includes:
- MeasuredHook
- Included in:
- Resque::Plugins::JobStats
- Defined in:
- lib/resque/plugins/job_stats/enqueued.rb
Overview
Extend your job with this module to track how many jobs are queued successfully
Instance Method Summary collapse
-
#after_enqueue_job_stats_enqueued(*args) ⇒ Object
Increments the enqueued count when job is queued.
-
#jobs_enqueued ⇒ Object
Returns the number of jobs enqueued.
-
#jobs_enqueued=(int) ⇒ Object
Sets the number of jobs queued.
-
#jobs_enqueued_key ⇒ Object
Returns the key used for tracking jobs enqueued.
Methods included from MeasuredHook
Instance Method Details
#after_enqueue_job_stats_enqueued(*args) ⇒ Object
Increments the enqueued count when job is queued
26 27 28 |
# File 'lib/resque/plugins/job_stats/enqueued.rb', line 26 def after_enqueue_job_stats_enqueued(*args) Resque.redis.incr(jobs_enqueued_key) end |
#jobs_enqueued ⇒ Object
Returns the number of jobs enqueued
16 17 18 |
# File 'lib/resque/plugins/job_stats/enqueued.rb', line 16 def jobs_enqueued Resque.redis.get(jobs_enqueued_key).to_i end |
#jobs_enqueued=(int) ⇒ Object
Sets the number of jobs queued
11 12 13 |
# File 'lib/resque/plugins/job_stats/enqueued.rb', line 11 def jobs_enqueued=(int) Resque.redis.set(jobs_enqueued_key,int) end |
#jobs_enqueued_key ⇒ Object
Returns the key used for tracking jobs enqueued
21 22 23 |
# File 'lib/resque/plugins/job_stats/enqueued.rb', line 21 def jobs_enqueued_key "stats:jobs:#{self.name}:enqueued" end |