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

Methods included from MeasuredHook

included, #inherited

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_performedObject

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_keyObject

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