Class: Faraday::Request::Retry::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/faraday/request/retry.rb

Constant Summary collapse

DEFAULT_CHECK =
lambda { |env,exception| false }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from(value) ⇒ Object


29
30
31
32
33
34
35
# File 'lib/faraday/request/retry.rb', line 29

def self.from(value)
  if Fixnum === value
    new(value)
  else
    super(value)
  end
end

Instance Method Details

#backoff_factorObject


53
54
55
# File 'lib/faraday/request/retry.rb', line 53

def backoff_factor
  (self[:backoff_factor] ||= 1).to_f
end

#exceptionsObject


57
58
59
60
# File 'lib/faraday/request/retry.rb', line 57

def exceptions
  Array(self[:exceptions] ||= [Errno::ETIMEDOUT, 'Timeout::Error',
                               Error::TimeoutError])
end

#intervalObject


41
42
43
# File 'lib/faraday/request/retry.rb', line 41

def interval
  (self[:interval] ||= 0).to_f
end

#interval_randomnessObject


49
50
51
# File 'lib/faraday/request/retry.rb', line 49

def interval_randomness
  (self[:interval_randomness] ||= 0).to_f
end

#maxObject


37
38
39
# File 'lib/faraday/request/retry.rb', line 37

def max
  (self[:max] ||= 2).to_i
end

#max_intervalObject


45
46
47
# File 'lib/faraday/request/retry.rb', line 45

def max_interval
  (self[:max_interval] ||= Float::MAX).to_f
end

#methodsObject


62
63
64
# File 'lib/faraday/request/retry.rb', line 62

def methods
  Array(self[:methods] ||= IDEMPOTENT_METHODS)
end

#retry_ifObject


66
67
68
# File 'lib/faraday/request/retry.rb', line 66

def retry_if
  self[:retry_if] ||= DEFAULT_CHECK
end