mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 13:06:31 +00:00
gps matcher async
put cryptography lib to fixed version fix race condition bug in queue handler add lock to db writing and backup to file db on each write
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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),
|
||||
(exception, timeSpan) => Console.WriteLine($"Exception: {exception}, TimeSpan: {timeSpan}"))
|
||||
.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);
|
||||
}
|
||||
Reference in New Issue
Block a user