Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuDanK committed Jan 13, 2023
2 parents fdb8c6b + cc585b1 commit 998c4ca
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions SageTools/Utils/ExtensionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ public static T DelayRetry<T>(Func<T> executeFunc, Func<T, bool> breakConditionF
while (retryCount > 0)
{
retryCount--;
res = executeFunc.Invoke();
if (breakConditionFunc.Invoke(res)) break;
Task.Delay(milliseconds).Wait();
try
{
res = executeFunc.Invoke();
if (breakConditionFunc.Invoke(res)) break;
Task.Delay(milliseconds).Wait();
}
catch
{
Task.Delay(milliseconds).Wait();
}
}

return res;
Expand All @@ -46,9 +53,16 @@ public static async Task<T> DelayRetryAsync<T>(Func<Task<T>> executeFunc, Func<T
while (retryCount > 0)
{
retryCount--;
res = await executeFunc.Invoke();
if (breakConditionFunc.Invoke(res)) break;
await Task.Delay(milliseconds);
try
{
res = await executeFunc.Invoke();
if (breakConditionFunc.Invoke(res)) break;
await Task.Delay(milliseconds);
}
catch
{
Task.Delay(milliseconds).Wait();
}
}

return res;
Expand Down

0 comments on commit 998c4ca

Please sign in to comment.