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
Copy file name to clipboardExpand all lines: src/LCT.APICommunications/RetryHttpClientHandler.cs
+7-8
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ public RetryHttpClientHandler()
28
28
onRetry:(outcome,timespan,attempt,context)=>
29
29
{
30
30
Logger.Debug($"Retry attempt {attempt} due to: {(outcome.Exception!=null?outcome.Exception.Message:$"{outcome.Result.StatusCode}")}");
31
+
Logger.Warn($"Retry attempt {attempt} will be triggered in {timespan.TotalSeconds} seconds due to: {(outcome.Exception!=null?outcome.Exception.Message:$"{outcome.Result.StatusCode}")}");
@@ -45,20 +46,18 @@ public static async Task ExecuteWithRetryAsync(Func<Task> action)
45
46
GetRetryInterval,
46
47
onRetry:(exception,timespan,attempt,context)=>
47
48
{
48
-
Logger.Debug($"Retry attempt {attempt} due to: {exception?.Message??"No exception"}");
49
+
Logger.Debug($"Retry attempt {attempt} due to: {exception?.Message??"No exception"}");
49
50
});
50
51
51
52
awaitretryPolicy.ExecuteAsync(action);
52
53
}
53
54
privatestaticTimeSpanGetRetryInterval(intattempt)
54
55
{
55
-
returnattemptswitch
56
-
{
57
-
1=>TimeSpan.FromSeconds(ApiConstant.APIRetryIntervalFirst),// 1st retry after 5 seconds
58
-
2=>TimeSpan.FromSeconds(ApiConstant.APIRetryIntervalSecond),// 2nd retry after 10 seconds
59
-
3=>TimeSpan.FromSeconds(ApiConstant.APIRetryIntervalThird),// 3rd retry after 30 seconds
60
-
_ =>TimeSpan.Zero// Default (not used)
61
-
};
56
+
// Define retry intervals as constants or values
57
+
varretryIntervals=new[]{ApiConstant.APIRetryIntervalFirst,ApiConstant.APIRetryIntervalSecond,ApiConstant.APIRetryIntervalThird};// Retry intervals for 1st, 2nd, and 3rd attempts
0 commit comments