lib/backburner/worker.rb in backburner-1.5.0 vs lib/backburner/worker.rb in backburner-1.6.0
- old
+ new
@@ -148,12 +148,14 @@
end
# NB: There's a slight chance here that the connection to beanstalkd has
# gone down between the time we reserved / processed the job and here.
num_retries = job.stats.releases
- retry_status = "failed: attempt #{num_retries+1} of #{queue_config.max_job_retries+1}"
- if num_retries < queue_config.max_job_retries # retry again
- delay = queue_config.retry_delay_proc.call(queue_config.retry_delay, num_retries) rescue queue_config.retry_delay
+ max_job_retries = resolve_max_job_retries(job.job_class)
+ retry_status = "failed: attempt #{num_retries+1} of #{max_job_retries+1}"
+ if num_retries < max_job_retries # retry again
+ retry_delay = resolve_retry_delay(job.job_class)
+ delay = resolve_retry_delay_proc(job.job_class).call(retry_delay, num_retries) rescue retry_delay
job.retry(num_retries + 1, delay)
self.log_job_end(job.name, "#{retry_status}, retrying in #{delay}s") if job_started_at
else # retries failed, bury
job.bury
self.log_job_end(job.name, "#{retry_status}, burying") if job_started_at