Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retry module download once if server errored #17252

Merged
merged 8 commits into from
Aug 1, 2023

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Jan 3, 2023

Closes #17251
Closes #19970

@piscisaureus
Copy link
Member

piscisaureus commented Jan 3, 2023

Awesome :)

It would be nice if a transient error here (this might be a transport level error such as ConnectionReset) would also trigger a retry.

EDIT: here

let response = request.send().await?;

@bartlomieju
Copy link
Member Author

Awesome :) It would be nice if a transient error here (this might be a transport level error such as ConnectionReset) would also trigger a retry.

@piscisaureus this link is not working for me, could you point to relevant line in code?

cli/file_fetcher.rs Outdated Show resolved Hide resolved
FetchOnceResult::ServerError(status) => {
// Retry once, and bail otherwise.
if !retried {
retried = true;
Copy link
Member

Choose a reason for hiding this comment

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

Should we do a slight delay when retrying? (maybe a few ms)

Copy link
Member Author

Choose a reason for hiding this comment

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

Added 50ms delay.

let mut res = Response::new(Body::empty());
*res.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
Ok(res)
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we add an endoint that errors the first time and succeeds the second?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's gonna be hard to add state to that server to verify how many times this function was called...

// Retry once, and bail otherwise.
if !retried {
retried = true;
continue;
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should log::warn when this occurs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member Author

Choose a reason for hiding this comment

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

Now that I'm thinking about it - a flake will cause this to be printed which will still fail tests. Maybe it should be log::debug instead?

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM. This will be a big improvement.

@bartlomieju bartlomieju merged commit 5df2b0b into denoland:main Aug 1, 2023
11 checks passed
@bartlomieju bartlomieju deleted the retry_failed_download_once branch August 1, 2023 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants