Sha256: b393975e46072bf6576d1b92857d0dab91fd2ce3a06e2c506ff430125de00225

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

== Description
  A thin wrapper for begin + rescue + sleep + retry.

== Installation
  gem install attempt   

== Synopsis
  require 'attempt'
   
  # Attempt to ftp to some host, trying 3 times with 30 seconds between
  # attempts before finally raising an error.
  #
  attempt(3, 30){
    Net::FTP.open(host, user, passwd){ ... }
  }
   
  # Or, do things the long way...
  code = Attempt.new{ |a|
    a.tries    = 3
    a.interval = 30
  }
   
  code.attempt{
    Net::FTP.open(host, user, passwd){ ... }
  }

== Known Bugs
  None that I'm aware of. If you find any bugs, please log them on the
  project page at:

  https://github.com/djberg96/attempt

== Caveats
  Use with caution. Specifically, make sure you aren't inadvertantly
  wrapping code that already performs sleep + retry. Otherwise, you'll
  end up with a series of nested retry's that could take much longer to
  work than you expect. 

  Also, this library uses the timeout library internally, which has some
  known issues. See Future Plans, below.

== Future Plans
  Add the ability to set an absolute maximum number of seconds to prevent
  nested sleep/retry from delaying attempts longer than expected.

  Replace the timeout library with a self selecting pipe if possible.

== Acknowledgements
  This library is partially based on Mark Fowler's 'Attempt' Perl module.

== Warranty
  This package is provided "as is" and without any express or
  implied warranties, including, without limitation, the implied
  warranties of merchantability and fitness for a particular purpose.

== License
  Artistic 2.0

== Copyright
  (C) 2006-2015, Daniel J. Berger
  All Rights Reserved

== Author
  Daniel J. Berger

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attempt-0.2.1 README