Class: Azure::Storage::Common::Core::Filter::LinearRetryPolicyFilter

Inherits:
RetryPolicyFilter
  • Object
show all
Defined in:
lib/azure/storage/common/core/filter/linear_retry_filter.rb

Constant Summary collapse

DEFAULT_RETRY_COUNT =
3
DEFAULT_RETRY_INTERVAL =
30

Instance Attribute Summary

Attributes inherited from RetryPolicyFilter

#retry_count, #retry_interval

Instance Method Summary collapse

Methods inherited from RetryPolicyFilter

#adjust_retry_request, #check_location, #check_status_code, #get_next_location, #init_retry_data, #should_retry?, #should_retry_on_error?, #should_retry_on_local_error?, #wait_for_retry

Constructor Details

#initialize(retry_count = nil, retry_interval = nil) ⇒ LinearRetryPolicyFilter

Returns a new instance of LinearRetryPolicyFilter.



31
32
33
34
35
36
# File 'lib/azure/storage/common/core/filter/linear_retry_filter.rb', line 31

def initialize(retry_count = nil, retry_interval = nil)
  @retry_count = retry_count || LinearRetryPolicyFilter::DEFAULT_RETRY_COUNT
  @retry_interval = retry_interval || LinearRetryPolicyFilter::DEFAULT_RETRY_INTERVAL

  super @retry_count, @retry_interval
end

Instance Method Details

#apply_retry_policy(retry_data) ⇒ Object

Overrides the base class implementation of call to determine how the HTTP request should continue retrying

retry_data - Hash. Stores stateful retry data

The retry_data is a Hash which can be used to store stateful data about the request execution context (such as an incrementing counter, timestamp, etc). The retry_data object will be the same instance throughout the lifetime of the request



50
51
52
53
# File 'lib/azure/storage/common/core/filter/linear_retry_filter.rb', line 50

def apply_retry_policy(retry_data)
  retry_data[:count] = retry_data[:count] == nil ? 1 : retry_data[:count] + 1
  retry_data[:interval] = @retry_interval
end