-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Misc fixes to starting dev server #3121
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Ignored Deployments
|
- The 10th attempt used to day "trying again" and then didn't try again because the iterator ended… - Swaps a nested `.map() == Some(bool)` for a `and_then` - Extracts into a helper function so code can early return without an Option<Result> wrapper.
f4e35b9
to
c135e88
Compare
🟢 CI successful 🟢Thanks |
Benchmark for 5f2629f
Click to view full benchmark
|
Benchmark for 7925de8
Click to view full benchmark
|
Benchmark for 7b42a5b
Click to view full benchmark
|
/// Attempts to find an open port to bind. | ||
fn find_port(&self, host: IpAddr, port: u16, max_attempts: u16) -> Result<DevServerBuilder> { | ||
// max_attempts of 1 means we loop 0 times. | ||
let max_attempts = max_attempts - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this argument be "retry" instead? That way we avoid integer underflow altogether. In any case, the semantics of max_attempts = 0
are not very clear. You could also use https://doc.rust-lang.org/beta/std/num/struct.NonZeroU16.html.
- The 10th attempt used to day "trying again" and then didn't try again because the iterator ended… - Swaps a nested `.map() == Some(bool)` for a `and_then` - Extracts into a helper function so code can early return without an `Option<Result>` wrapper.
- The 10th attempt used to day "trying again" and then didn't try again because the iterator ended… - Swaps a nested `.map() == Some(bool)` for a `and_then` - Extracts into a helper function so code can early return without an `Option<Result>` wrapper.
.map() == Some(bool)
for aand_then
Option<Result>
wrapper.