diff options
author | Jeffrey Guenther <guenther.jeffrey@gmail.com> | 2017-12-08 13:25:54 -0800 |
---|---|---|
committer | Jeffrey Guenther <guenther.jeffrey@gmail.com> | 2017-12-08 13:25:54 -0800 |
commit | a822287cefc38b9b8b3be38ffd775cd3d511b7c3 (patch) | |
tree | d69c6ea1fcc4299caa11bcbef2ce5520347a4f46 /activejob/lib | |
parent | 08fab27db52aa375df85a23e89799600f785b9d4 (diff) | |
parent | da8e0ba03cbae33857954c0c1a228bd6dae562da (diff) | |
download | rails-a822287cefc38b9b8b3be38ffd775cd3d511b7c3.tar.gz rails-a822287cefc38b9b8b3be38ffd775cd3d511b7c3.tar.bz2 rails-a822287cefc38b9b8b3be38ffd775cd3d511b7c3.zip |
Merge branch 'master' into activestorage-guide
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/core.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/activejob/lib/active_job/core.rb b/activejob/lib/active_job/core.rb index c4e12fc518..879746fc01 100644 --- a/activejob/lib/active_job/core.rb +++ b/activejob/lib/active_job/core.rb @@ -97,17 +97,23 @@ module ActiveJob # ==== Examples # # class DeliverWebhookJob < ActiveJob::Base + # attr_writer :attempt_number + # + # def attempt_number + # @attempt_number ||= 0 + # end + # # def serialize - # super.merge('attempt_number' => (@attempt_number || 0) + 1) + # super.merge('attempt_number' => attempt_number + 1) # end # # def deserialize(job_data) # super - # @attempt_number = job_data['attempt_number'] + # self.attempt_number = job_data['attempt_number'] # end # - # rescue_from(TimeoutError) do |exception| - # raise exception if @attempt_number > 5 + # rescue_from(Timeout::Error) do |exception| + # raise exception if attempt_number > 5 # retry_job(wait: 10) # end # end |