Ejemplo n.º 1
0
        private async Task <string> TryGetHashAsync(string requestURL, System.Net.Http.HttpClient httpClient)
        {
            var tryCount = 2;

            while (true)
            {
                try
                {
                    return(await httpClient.CheckedGetStringAsync(requestURL));
                }
                catch (Exception e)
                {
                    if ((tryCount > 1) &&
                        ((IsExceptionForRetry(e) ||
                          ((e is AggregateException) && (e as AggregateException).InnerExceptions.Any(x => IsExceptionForRetry(x))))))
                    {
                        tryCount--;
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }