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

retry toolchain update, only lock queue after 3 failed attempts #1789

Merged
merged 3 commits into from Sep 4, 2022

Conversation

syphar
Copy link
Member

@syphar syphar commented Aug 3, 2022

This is a simple attempt at solving #1787.

Since I don't know details about update_toolchain: are there any possible errors that might leave the toolchain in a broken state where a retry would make it worse?

@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Aug 3, 2022
@Nemo157
Copy link
Member

Nemo157 commented Aug 3, 2022

Since I don't know details about update_toolchain: are there any possible errors that might leave the toolchain in a broken state where a retry would make it worse?

There shouldn't be, it's using rustup to do the update which goes to some pain to try and make the update process atomic.

src/build_queue.rs Outdated Show resolved Hide resolved
@syphar syphar requested a review from Nemo157 August 4, 2022 05:41
@syphar
Copy link
Member Author

syphar commented Aug 8, 2022

@Nemo157 is anything missing here? I'm happy to add what's needed

}
}
}
unreachable!()
Copy link
Member

@jyn514 jyn514 Aug 9, 2022

Choose a reason for hiding this comment

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

nit: you could avoid this by using loop instead of for

@@ -188,6 +188,27 @@ impl BuildQueue {
}
}

fn retry<T>(mut f: impl FnMut() -> Result<T>) -> Result<T> {
const MAX_ATTEMPTS: u8 = 3;
Copy link
Member

@jyn514 jyn514 Aug 9, 2022

Choose a reason for hiding this comment

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

If you're going to make retry reusable, I would expect this to be a function parameter.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made this an parameter

Comment on lines +193 to +227
for attempt in 1.. {
match f() {
Copy link
Member

Choose a reason for hiding this comment

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

this retries immediately, right? shouldn't we wait between requests?

Copy link
Member Author

Choose a reason for hiding this comment

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

Valid point 😄

( funny I didn't think of that, must have been a case of nightly blackout 😂)

Copy link
Member Author

Choose a reason for hiding this comment

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

I added exponential sleep between the tries

@syphar syphar requested a review from jyn514 August 11, 2022 17:47
@syphar
Copy link
Member Author

syphar commented Aug 26, 2022

@Nemo157 @jyn514 ping?

@syphar syphar merged commit a074c8a into rust-lang:master Sep 4, 2022
@syphar syphar deleted the retry-toolchain-update branch September 4, 2022 11:16
@github-actions github-actions bot added S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Sep 4, 2022
@syphar syphar removed the S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it label Sep 17, 2022
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.

None yet

3 participants