Future!T that resolves with the first successful result, or
rejects after all attempts are exhausted.
Future!T retry(T)(T delegate() @safe factory, int maxAttempts, long delayMs = 0, EventLoop * loop = null) @trustedRetry 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.
factory | Delegate that produces a value or throws on failure. |
maxAttempts | Maximum number of attempts (minimum 1). |
delayMs | Delay between retries in milliseconds. 0 for immediate retry. |
loop | Event loop for scheduling retry delays. May be null if delayMs is 0. |
Future!T that resolves with the first successful result, or
rejects after all attempts are exhausted.