mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 21:46:30 +00:00
c0f8dd792d
fix same files problem in python different libs correct command logging in command handler
14 lines
577 B
C#
14 lines
577 B
C#
using Polly;
|
|
|
|
public static class ResilienceExt
|
|
{
|
|
public static void WithRetry(this Action operation, int retryCount = 3, int delayMs = 150) =>
|
|
Policy.Handle<Exception>()
|
|
.WaitAndRetry(retryCount, num => TimeSpan.FromMilliseconds(num * delayMs))
|
|
.Execute(operation);
|
|
|
|
public static TResult WithRetry<TResult>(this Func<TResult> operation, int retryCount = 3, int delayMs = 150) =>
|
|
Policy.Handle<Exception>()
|
|
.WaitAndRetry(retryCount, num => TimeSpan.FromMilliseconds(num * delayMs))
|
|
.Execute(operation);
|
|
} |