Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Document the changes that were made in the pull request:
https://github.com/collectiveidea/delayed_job/pull/168/files

Looking at the code in that PR I figured that the max_attempts needs to be set on the payload and I tried setting it on the custom job and it worked as expected. This feature is indeed very useful and hopefully this is well-documented and maintained in future releases. Greatly appreciate this gem!

A question - would this work with the object.delay.some_method usage. Didn't seem like it would since the DB table does not have the max_attempts as a column.
  • Loading branch information
gpai-mdsol committed May 17, 2013
1 parent d6cbf48 commit 443c6aa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -229,6 +229,19 @@ end

Delayed::Job.enqueue NewsletterJob.new('lorem ipsum...', Customers.find(:all).collect(&:email))
```
To set a per-job max attempts that overrides the Delayed::Worker.max_attempts you can define a max_attempts method on the job
```ruby
class NewsletterJob < Struct.new(:text, :emails)
def perform
emails.each { |e| NewsletterMailer.deliver_text_to_email(text, e) }
end

def max_attempts
return 3
end
end
````


Hooks
=====
Expand Down

0 comments on commit 443c6aa

Please sign in to comment.