retry

fnFuture!T retry(T)(T delegate() @safe factory, int maxAttempts, long delayMs = 0, EventLoop * loop = null) @trusted

Retry a synchronous operation up to maxAttempts times.

Executes factory immediately on the first attempt. If it throws, retries after delayMs milliseconds (using the provided event loop) until it succeeds or the maximum number of attempts is exhausted.

Parameters

factoryDelegate that produces a value or throws on failure.
maxAttemptsMaximum number of attempts (minimum 1).
delayMsDelay between retries in milliseconds. 0 for immediate retry.
loopEvent loop for scheduling retry delays. May be null if delayMs is 0.

Returns

A Future!T that resolves with the first successful result, or

rejects after all attempts are exhausted.