Retry

Basic retrying class. Retries a specified block of code a specified number of times before giving up. The 'code block' is passed as a lazy bool parameter to the loop() / opCall() method.

The failure condition for the block of code can be set by passing a delegate to the constructor. The default failure condition is that any exception thrown while executing the code block indicates failure.

The behaviour of the class can be easily modified by inherting and overriding the following methods:

More...

Constructors

this
this(SuccessDecider success_decide)

Constructor.

Members

Aliases

SuccessDecider
alias SuccessDecider = bool delegate(lazy void)

Alias for a delegate which executes a code block and decides if it has succeeded or failed.

opCall
alias opCall = loop
Undocumented in source.

Functions

loop
void loop(uint max_retries, void dg)

Initiates the execution and possible retrying of a block of code.

on_retry
void on_retry()

Called before a retry is commenced. The base class behaviour does nothing, but it can be overridden by derived classes to implement special behaviour on retry.

retry_decide
bool retry_decide()

Decides whether to keep retrying or to give up.

Detailed Description

retry decide

decides whether to keep retrying or to give up

on retry

called every time a retry occurs (does nothing by default)

Meta