RUST-1447 Cache test client metadata#1318
Merged
isabelatkinson merged 4 commits intomongodb:mainfrom Mar 6, 2025
Merged
Conversation
Contributor
Author
|
windows failures are unrelated, I'm investigating and will fix in a separate PR |
abr-egn
approved these changes
Mar 5, 2025
src/test.rs
Outdated
| } | ||
|
|
||
| async fn get_server_version() -> &'static semver::Version { | ||
| static SERVER_VERSION: OnceCell<semver::Version> = OnceCell::const_new(); |
Contributor
There was a problem hiding this comment.
I wonder if it might be better to bundle the static values into a single struct with a single lazy initializer; as it is a new Client has to be constructed for each group of related functions and that would collapse it down to a single one.
This is well into micro-optimization territory, though, so up to you if you want to implement that or merge as-is :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RUST-1447
Removes all server round-trips from test client creation and instead caches client metadata in a number of lazy static variables in
src/test.rs. The changes outside ofsrc/test.rsandsrc/test/util.rsare largely search-and-replace; I also removed some checks related to 4.0 now that we don't support/test any lower server versions.