Module: Resque::Plugins::JobStats::Failed
- Includes:
- MeasuredHook
- Included in:
- Resque::Plugins::JobStats
- Defined in:
- lib/resque/plugins/job_stats/failed.rb
Overview
Extend your job with this module to track how many jobs fail
Instance Method Summary collapse
-
#jobs_failed ⇒ Object
Returns the number of jobs failed.
-
#jobs_failed=(int) ⇒ Object
Sets the number of jobs failed.
-
#jobs_failed_key ⇒ Object
Returns the key used for tracking jobs failed.
-
#on_failure_job_stats_failed(e, *args) ⇒ Object
Increments the failed count when job is complete.
Methods included from MeasuredHook
Instance Method Details
#jobs_failed ⇒ Object
Returns the number of jobs failed
16 17 18 19 20 |
# File 'lib/resque/plugins/job_stats/failed.rb', line 16 def jobs_failed jobs_failed = Resque.redis.get(jobs_failed_key).to_i return jobs_failed / 2 if Resque::VERSION == '1.20.0' jobs_failed end |
#jobs_failed=(int) ⇒ Object
Sets the number of jobs failed
11 12 13 |
# File 'lib/resque/plugins/job_stats/failed.rb', line 11 def jobs_failed=(int) Resque.redis.set(jobs_failed_key,int) end |
#jobs_failed_key ⇒ Object
Returns the key used for tracking jobs failed
23 24 25 |
# File 'lib/resque/plugins/job_stats/failed.rb', line 23 def jobs_failed_key "stats:jobs:#{self.name}:failed" end |
#on_failure_job_stats_failed(e, *args) ⇒ Object
Increments the failed count when job is complete
28 29 30 |
# File 'lib/resque/plugins/job_stats/failed.rb', line 28 def on_failure_job_stats_failed(e,*args) Resque.redis.incr(jobs_failed_key) end |