lib/qpush/server/execute.rb in qpush-0.1.1 vs lib/qpush/server/execute.rb in qpush-0.1.2

- old
+ new

@@ -37,18 +37,22 @@ @job = job @error = error end def call - @job.bump_fail - @job.api.retry if @job.retry_job? + update_job stat_increment log_error end private + def update_job + @job.bump_fail + @job.api.retry if @job.retry_job? + end + def stat_increment QPush.redis.with do |c| c.incr("#{QPush.config.stats_namespace}:dead") if @job.dead_job? c.incr("#{QPush.config.stats_namespace}:failed") end @@ -68,16 +72,20 @@ def initialize(job) @job = job end def call - @job.bump_success - @job.api.delay if @job.delay_job? + update_job stat_increment log_success end private + + def update_job + @job.bump_success + @job.api.delay if @job.delay_job? + end def stat_increment QPush.redis.with do |c| c.incr("#{QPush.config.stats_namespace}:success") end