Retry on HttpTimeout and other exceptions#5053
Conversation
Sometimes this call throws after a client timeout and causes aka.ms link generation to fail. Retry in these cases.
|
@jaredpar This should solve one of the major cases of the aka.ms link generation. I am working on a more complete fix. The issue for runtime appears to be the number of links. The aka.ms API is missing a bit of functionality. It has a bulk create API, a bulk update API, but you can't use create if you want to overwrite, and you can't use update if the link doesn't already exist. This means that you have to bucketize the links into exists/not-exists prior to the create/update. The get api doesn't have a bulk version, which means a bunch of individual calls to the status API. This appears okay for most repos, including aspnet, but runtime has a more "unified" manifest, which means the number of parallel calls is higher (it is capped at 8, but we're hammering the API). What I think I'm going to do is it around to assume that the links already exist, and if the update fails, then bucketize links and do a create+update. |
| response.StatusCode == HttpStatusCode.Forbidden) | ||
| { | ||
| _log.LogError($"Error deleting aka.ms/{link}: {response.Content.ReadAsStringAsync().Result}"); | ||
| return true; |
There was a problem hiding this comment.
No, we don't want to retry in these cases because they're just going to give the same result the second time around (e.g. bad credentials)
There was a problem hiding this comment.
It might be more intuitive for readers here if the code threw an exception rather than logging an error then returning true.
(I don't think I anticipated this usage of the retry API... maybe it would have been better for it to use an enum that's precise about what the value actually does (Stop and TryAgain?), to avoid this interesting meaning of true.)
| response.StatusCode == HttpStatusCode.Forbidden) | ||
| { | ||
| _log.LogError($"Error creating/updating aka.ms links: {response.Content.ReadAsStringAsync().Result}"); | ||
| return true; |
There was a problem hiding this comment.
No, we don't want to retry in these cases because they're just going to give the same result the second time around (e.g. bad credentials)
Relates to: #5044
Sometimes this call throws after a client timeout and causes aka.ms link
generation to fail. Retry in these cases.