olp-cpp-sdk  1.18.1
Public Types | Public Attributes | List of all members
olp::client::RetrySettings Struct Reference

A collection of settings that controls how failed requests should be treated by the Data SDK. More...

#include <RetrySettings.h>

Public Types

using BackdownStrategy = std::function< std::chrono::milliseconds(std::chrono::milliseconds, size_t)>
 Calculates the number of retry timeouts based on the initial backdown duration and retries count.
 
using RetryCondition = std::function< bool(const HttpResponse &)>
 Checks whether the retry is desired. More...
 

Public Attributes

int max_attempts = 3
 The number of attempts. More...
 
int timeout = 60
 Maximum time for request to complete (in seconds). More...
 
std::chrono::milliseconds connection_timeout = std::chrono::seconds(30)
 Time allowed to wait for connection to establish (in milliseconds). More...
 
std::chrono::milliseconds transfer_timeout = std::chrono::seconds(30)
 Time allowed to wait without data transfer (in milliseconds). More...
 
int initial_backdown_period = 200
 The period between the error and the first retry attempt (in milliseconds).
 
BackdownStrategy backdown_strategy = ExponentialBackdownStrategy()
 The backdown strategy. More...
 
RetryCondition retry_condition = DefaultRetryCondition
 Evaluates responses to determine if the retry should be attempted.
 

Detailed Description

A collection of settings that controls how failed requests should be treated by the Data SDK.

For example, it specifies whether the failed request should be retried, how long Data SDK needs to wait for the next retry attempt, the number of maximum retries, and so on.

You can customize all of these settings. The settings are used internally by the OlpClient class.

Member Typedef Documentation

◆ RetryCondition

using olp::client::RetrySettings::RetryCondition = std::function<bool(const HttpResponse&)>

Checks whether the retry is desired.

See also
HttpResponse for more details.

Member Data Documentation

◆ backdown_strategy

BackdownStrategy olp::client::RetrySettings::backdown_strategy = ExponentialBackdownStrategy()

The backdown strategy.

Defines the delay between retries on a failed request.

◆ connection_timeout

std::chrono::milliseconds olp::client::RetrySettings::connection_timeout = std::chrono::seconds(30)

Time allowed to wait for connection to establish (in milliseconds).

The default value is 30 seconds.

Note
The value should be smaller than timeout,
See also
timeout for more details.

◆ max_attempts

int olp::client::RetrySettings::max_attempts = 3

The number of attempts.

The default value is 3.

◆ timeout

int olp::client::RetrySettings::timeout = 60

Maximum time for request to complete (in seconds).

The default value is 60.

Note
Connection or data transfer will be interrupted after specified period of time ignoring connection_timeout and transfer_timeout values.

◆ transfer_timeout

std::chrono::milliseconds olp::client::RetrySettings::transfer_timeout = std::chrono::seconds(30)

Time allowed to wait without data transfer (in milliseconds).

The default value is 30 seconds.

Note
The value should be smaller than timeout,
See also
timeout for more details.

The documentation for this struct was generated from the following file: