DurableCall
Invoke methods DRY and safely with parameterized retries, timeouts and logging
Installation
Add this line to your application's Gemfile:
gem 'durable_call'
And then execute:
$ bundle
Or install it yourself as:
$ gem install durable_call
Usage
Simple usage:
DurableCall.call(Object.new, :object_id)
Multiple arguments and options:
DurableCall.call(Something.new, [:method_name, :param, :other_param], )
Where options
may take:
{
:interval # 1. lambda, which takes retry number (min 1) and returns seconds to sleep
# 2. just Float
# 3. Symbol for built-in strategies, defaults to :rand
:logger # Logger object, defaults to nil
:retries # retries number, defaults to 0
:timeout # operation timeout, defaults to nil (no time limits)
}
Also, it's possible to perform multiple calls with the same options:
caller = DurableCall::Caller.new(Something.new, )
caller.call(:method_name, :param, :other_param)
caller.call(:faster_faster, :no_instantiation_overhead)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request