Skip to content

Retry on HttpTimeout and other exceptions#5053

Merged
mmitche merged 1 commit intodotnet:masterfrom
mmitche:its-the-end-of-the-world-as-we-know-it
Mar 13, 2020
Merged

Retry on HttpTimeout and other exceptions#5053
mmitche merged 1 commit intodotnet:masterfrom
mmitche:its-the-end-of-the-world-as-we-know-it

Conversation

@mmitche
Copy link
Member

@mmitche mmitche commented Mar 12, 2020

Relates to: #5044

Sometimes this call throws after a client timeout and causes aka.ms link
generation to fail. Retry in these cases.

Sometimes this call throws after a client timeout and causes aka.ms link
generation to fail. Retry in these cases.
@mmitche
Copy link
Member Author

mmitche commented Mar 12, 2020

@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.

@mmitche mmitche requested a review from JohnTortugo March 12, 2020 21:55
response.StatusCode == HttpStatusCode.Forbidden)
{
_log.LogError($"Error deleting aka.ms/{link}: {response.Content.ReadAsStringAsync().Result}");
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be false?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be false?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@mmitche mmitche merged commit b0d830a into dotnet:master Mar 13, 2020
@mmitche mmitche deleted the its-the-end-of-the-world-as-we-know-it branch February 9, 2022 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants