diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-05 16:32:42 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-05 16:32:42 +0900 |
commit | 0f8568f58d36a543f9eb423171f42731784b34af (patch) | |
tree | ea04c612c55eaf38c02f14cdd24eca4af07b47ea /activejob/lib/active_job | |
parent | 3c442b6df91e291ebbf17f37444414bf5f10fbe6 (diff) | |
parent | 649f19cab1d4dd805c915912ede29c86655084cd (diff) | |
download | rails-0f8568f58d36a543f9eb423171f42731784b34af.tar.gz rails-0f8568f58d36a543f9eb423171f42731784b34af.tar.bz2 rails-0f8568f58d36a543f9eb423171f42731784b34af.zip |
Merge pull request #31334 from yhirano55/fix_example_code_in_active_job
Fix example code in ActiveJob::Core [ci skip]
Diffstat (limited to 'activejob/lib/active_job')
-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 |