You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor PolicyFactory and event handler retry logic
- Updated `CreatePolicy` method to set default `withFallBack` to `false` and `retryDelay` to 2 seconds. Removed fallback policy logic.
- Simplified calls to `PolicyFactory.CreatePolicy` in event handlers by removing hardcoded retry count, relying on defaults.
- Enhanced logging in retry policy to provide detailed error information.
- Modified `HandleSpecificDomainEvent` methods for consistent application of retry policies across domain events.
.HandleResult(result =>!result.IsSuccess&&String.Join("|",result.Errors).Contains("Append failed due to WrongExpectedVersion"))// Retry if the result is not successful
52
+
.OrResult(result=>!result.IsSuccess&&String.Join("|",result.Errors).Contains("DeadlineExceeded"))// Retry if the result is not successful
57
53
.WaitAndRetryAsync(retryCount,
58
54
_ =>retryDelay,// Fixed delay
59
-
(exception,timeSpan,retryCount,context)=>
55
+
(result,timeSpan,retryCount,context)=>
60
56
{
61
57
context["RetryCount"]=retryCount;
62
-
Logger.LogWarning($"{policyTag} - Retry {retryCount} due to {exception.Exception.GetType().Name}. Waiting {timeSpan} before retrying...");
Logger.LogWarning($"{policyTag} - Retry {retryCount} due to unsuccessful result {String.Join(".",result.Result.Errors)}. Waiting {timeSpan} before retrying...");
0 commit comments