More docs
This commit is contained in:
parent
899a1dd399
commit
e11976f9a2
1 changed files with 21 additions and 14 deletions
|
@ -31,24 +31,31 @@ def Signal.[] s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Description
|
||||||
|
# ===========
|
||||||
|
#
|
||||||
# Counts retries ot something. If the retries are to often in a short time,
|
# Counts retries ot something. If the retries are to often in a short time,
|
||||||
# you shouldn't retry again.
|
# you shouldn't retry again.
|
||||||
#
|
#
|
||||||
# Example:
|
# Examples
|
||||||
# retries = Retry.new 5, 1
|
# ========
|
||||||
# begin
|
|
||||||
# array_of_ints_and_some_strings.each do |i|
|
|
||||||
# puts 2*i
|
|
||||||
# end
|
|
||||||
# rescue TypeError
|
|
||||||
# retries.retry? and retry
|
|
||||||
# raise $!
|
|
||||||
# end
|
|
||||||
#
|
#
|
||||||
# Retry.new( 10, 30).run( ConnectionLost) do
|
# Strings aren't Integers and 2*"Text" will raise TypeError.
|
||||||
# try_to_connect_to_db
|
#
|
||||||
# try_query
|
# retries = Retry.new 5, 1
|
||||||
# end
|
# begin
|
||||||
|
# array_of_ints_and_some_strings.each do |i|
|
||||||
|
# puts 2*i
|
||||||
|
# end
|
||||||
|
# rescue TypeError
|
||||||
|
# retries.retry? and retry
|
||||||
|
# raise $!
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# Retry.new( 10, 30).run( ConnectionLost) do
|
||||||
|
# try_to_connect_to_db
|
||||||
|
# try_query
|
||||||
|
# end
|
||||||
class Retries
|
class Retries
|
||||||
attr_accessor :max, :range
|
attr_accessor :max, :range
|
||||||
attr_reader :count, :last
|
attr_reader :count, :last
|
||||||
|
|
Loading…
Reference in a new issue