define max_attempts for jobs
This commit is contained in:
parent
95f925f5f7
commit
705487dab6
11 changed files with 24 additions and 8 deletions
|
@ -1,4 +1,6 @@
|
|||
class ApplicationJob < ActiveJob::Base
|
||||
DEFAULT_MAX_ATTEMPTS_JOBS = 25
|
||||
|
||||
before_perform do |job|
|
||||
Rails.logger.info("#{job.class.name} started at #{Time.zone.now}")
|
||||
end
|
||||
|
@ -18,4 +20,8 @@ class ApplicationJob < ActiveJob::Base
|
|||
def error(job, exception)
|
||||
Raven.capture_exception(exception)
|
||||
end
|
||||
|
||||
def max_attempts
|
||||
ENV["MAX_ATTEMPTS_JOBS"].to_i || DEFAULT_MAX_ATTEMPTS_JOBS
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue