Lightweight 0.20260921.0
Loading...
Searching...
No Matches
Lightweight::SqlRetrySettings Struct Reference

#include <SqlRetryPolicy.hpp>

Public Attributes

unsigned maxRetries = 3
 
std::chrono::milliseconds initialDelay { 500 }
 Delay before the first retry.
 
double backoffMultiplier = 2.0
 Multiplier applied to the delay after each failed attempt (exponential backoff).
 
std::chrono::milliseconds maxDelay { 30'000 }
 Upper bound on any single delay, so a long budget cannot produce an unbounded wait.
 
std::chrono::milliseconds totalDelayBudget { 0 }
 

Detailed Description

Backoff configuration of a SqlRetryPolicy.

This is the descriptor half of the policy: pure data, no behaviour, so it can be read from a config file, held in a settings struct, or written inline at a call site.

Definition at line 27 of file SqlRetryPolicy.hpp.

Member Data Documentation

◆ maxRetries

unsigned Lightweight::SqlRetrySettings::maxRetries = 3

Maximum number of retries — an operation is attempted at most maxRetries+1 times. Zero disables retrying without disabling the classification machinery.

Definition at line 31 of file SqlRetryPolicy.hpp.

◆ initialDelay

std::chrono::milliseconds Lightweight::SqlRetrySettings::initialDelay { 500 }

Delay before the first retry.

Definition at line 34 of file SqlRetryPolicy.hpp.

◆ backoffMultiplier

double Lightweight::SqlRetrySettings::backoffMultiplier = 2.0

Multiplier applied to the delay after each failed attempt (exponential backoff).

Definition at line 37 of file SqlRetryPolicy.hpp.

◆ maxDelay

std::chrono::milliseconds Lightweight::SqlRetrySettings::maxDelay { 30'000 }

Upper bound on any single delay, so a long budget cannot produce an unbounded wait.

Definition at line 40 of file SqlRetryPolicy.hpp.

◆ totalDelayBudget

std::chrono::milliseconds Lightweight::SqlRetrySettings::totalDelayBudget { 0 }

Deadline expressed as a budget: once the delays already spent plus the next planned delay would exceed this, the policy gives up with SqlRetryGiveUpReason::DelayBudgetExhausted instead of waiting. Zero — the default — means "no deadline, bounded only by @ref maxRetries".

A budget is used rather than a wall-clock deadline so that the decision stays pure: it depends only on the caller-supplied SqlRetryState, never on the current time.

Definition at line 49 of file SqlRetryPolicy.hpp.


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