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

testserver: short circuit downloading before making a request #173

Merged
merged 1 commit into from Nov 17, 2023

Conversation

pawalt
Copy link
Contributor

@pawalt pawalt commented Nov 17, 2023

Previously, the testserver would always make a get request to download
the cockroach binary. This commit short circuits the download logic to
avoid making the initial request if the file already exists.

@pawalt pawalt self-assigned this Nov 17, 2023
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@pawalt pawalt marked this pull request as ready for review November 17, 2023 18:50
Previously, the testserver would always make a get request to download
the cockroach binary. This commit short circuits the download logic to
avoid making the initial request if the file already exists.
if err != nil {
return "", err
}
localFile := filepath.Join(os.TempDir(), filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

curious how the short-circuiting will work. won't localFile be different each time this is called, since os.TempDir would return a different directory?

Choose a reason for hiding this comment

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

No. You may be thinking of MkdirTemp.

@pawalt pawalt merged commit 4d4495e into master Nov 17, 2023
3 checks passed
@pawalt pawalt deleted the pawalt/binary_shortcircuit branch November 17, 2023 19:36
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

4 participants