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