tlopo-retry

A reusable retry mechanism which supports timeout, cleanup and fork
Installation
Add this line to your application's Gemfile:
gem 'tlopo-retry'
And then execute:
bundle
Or install it yourself as:
gem install tlopo-retry
Usage
Simple retry usage
Tlopo::Retry.retry do
TCPSocket.new('www.google.co.uk','8080').close
end
Full options
require 'logger'
require 'socket'
ENV['TLOPO_LOG_LEVEL'] = 'debug'
require 'tlopo/retry'
Tlopo::Retry.retry({
desc: 'check if port 8080 is open on www.google.co.uk',
tries: 2,
interval: 5,
timeout: 1,
cleanup: proc { p 'Run your cleanup code here'}
}) do
TCPSocket.new('www.google.co.uk','8080').close
end
Contributing
- Fork it ( https://github.com/[my-github-username]/kubeclient/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Test your changes with
rake test rubocop
, add new tests if needed. - If you added a new functionality, add it to README
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Tests
This library is tested with Minitest.
Please run all tests before submitting a Pull Request, and add new tests for new functionality.
Running tests:
rake test