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

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

Overview

Options contains the configurable parameters for the Retry middleware.

Constant Summary collapse

DEFAULT_CHECK =
->(_env, _exception) { false }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from(value) ⇒ Object


41
42
43
44
45
46
47
# File 'lib/faraday/request/retry.rb', line 41

def self.from(value)
  if value.is_a?(Integer)
    new(value)
  else
    super(value)
  end
end

Instance Method Details

#backoff_factorObject


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

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

#exceptionsObject


69
70
71
# File 'lib/faraday/request/retry.rb', line 69

def exceptions
  Array(self[:exceptions] ||= DEFAULT_EXCEPTIONS)
end

#intervalObject


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

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

#interval_randomnessObject


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

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

#maxObject


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

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

#max_intervalObject


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

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

#methodsObject


73
74
75
# File 'lib/faraday/request/retry.rb', line 73

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

#retry_blockObject


81
82
83
# File 'lib/faraday/request/retry.rb', line 81

def retry_block
  self[:retry_block] ||= proc {}
end

#retry_ifObject


77
78
79
# File 'lib/faraday/request/retry.rb', line 77

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

#retry_statusesObject


85
86
87
# File 'lib/faraday/request/retry.rb', line 85

def retry_statuses
  Array(self[:retry_statuses] ||= [])
end