nesquena / backburner

Simple and reliable beanstalkd job queue for ruby
http://nesquena.github.com/backburner
MIT License
428 stars 68 forks source link

Allow the calculation of delays to be configurable #102

Closed contentfree closed 9 years ago

contentfree commented 9 years ago

I wanted to have exponential back-off in Backburner and looking through the code I found the hidden (and unconfigurable) exponential back-off used when calculating delay times (and I learned that retry_delay is actually just the minimum retry delay).

So I made the retry delay calculation a configurable lambda. This also allows you to use just the configured retry_delay with lambda { |retry_delay, _| retry_delay }

It defaults to what the code does today and should be backwards compatible. It has test coverage (and I updated the README, too).

nesquena commented 9 years ago

This is my own fault for taking a little while to merge this, but could you rebase your branch against latest master. I will merge this in and be cutting a new backburner release soon.

contentfree commented 9 years ago

Rebased to master and added an example to the README.

nesquena commented 9 years ago

Merged, thanks