diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index 0f0deaf..c29e412 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -364,7 +364,7 @@ namespace AyaNovaQBI } - + public async static Task PutAsync(string route, dynamic d) { Exception FirstException = null; @@ -387,6 +387,28 @@ namespace AyaNovaQBI throw new Exception($"API call failed after {MAX_TRIES.ToString()} attempts", FirstException); } + public async static Task 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 PutAsync(string route) { Exception FirstException = null;