public void OpWithData(int retries, int delay, byte[] data, Current current, CancellationToken cancel) { if (retries > _counter++) { throw new SystemFailure(RetryPolicy.AfterDelay(TimeSpan.FromMilliseconds(delay))); } _counter = 0; }
public void AfterDelay(int n, Current current, CancellationToken cancel) { if (++_n < n) { throw new ObjectNotExistException(RetryPolicy.AfterDelay(TimeSpan.FromMilliseconds(10))); } _n = 0; }
public int OpAfterDelay(int retries, int delay, Current current, CancellationToken cancel) { if (retries > _counter) { _counter++; throw new SystemFailure(RetryPolicy.AfterDelay(TimeSpan.FromMilliseconds(delay))); } int counter = _counter; _counter = 0; return(counter); }
public int OpIdempotent(int nRetry, Current current, CancellationToken cancel) { int[] delays = new int[] { 0, 1, 10000 }; if (nRetry > _counter) { throw new SystemFailure(RetryPolicy.AfterDelay(TimeSpan.FromMilliseconds(delays[_counter++ % 3]))); } int counter = _counter; _counter = 0; return(counter); }
public void OpNotIdempotent(Current current, CancellationToken cancel) => throw new ConnectionLostException(RetryPolicy.AfterDelay(TimeSpan.Zero));