This commit is contained in:
@@ -387,6 +387,28 @@ namespace AyaNovaQBI
|
|||||||
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
|
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async static Task<ApiResponse> PutAsync(string route, string s=null)
|
||||||
|
{
|
||||||
|
Exception FirstException = null;
|
||||||
|
|
||||||
|
for (int x = 0; x < MAX_TRIES; x++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await TryPutAsync(route, s);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (FirstException == null)
|
||||||
|
FirstException = ex;
|
||||||
|
}
|
||||||
|
await Task.Delay(API_RETRY_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
//no luck re-throw the exception
|
||||||
|
throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException);
|
||||||
|
}
|
||||||
|
|
||||||
public async static Task<ApiResponse> PutAsync(string route)
|
public async static Task<ApiResponse> PutAsync(string route)
|
||||||
{
|
{
|
||||||
Exception FirstException = null;
|
Exception FirstException = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user