Repository navigation
Ads-Client: Refactors build_memory and matches parity between sqlite databases - #7778
Draft
thesuzerain wants to merge 2 commits into
Draft
thesuzerain wants to merge 2 commits into
thesuzerain wants to merge 2 commits into
Conversation
thesuzerain
commented
Nov 13, 2026
| .as_ref() | ||
| .map(|x| x.db_path.clone()) | ||
| .unwrap_or(IN_MEMORY_DB_PATH.to_string()); | ||
| let default_cache_ttl = Duration::from_secs( |
Collaborator
Author
There was a problem hiding this comment.
This solution is a little bit uglier than the previous in that its more LoC (when formatted, at least), and the repeated cache_config.as_ref()
But its flatter and does not require multiple builders (as it would if you do if let Some(config) = config or some other uglier workarounds.
Another option I elected against was adding a Default implementation for AdsCacheConfig- which clears out the need for the repeated .cache_config.as_ref(), but since we have a non-optional field it feels like a bit of a smell (and I prefer keeping that field mandatory.
I can also revert it to the former logic which is essentially:
if let Some(config) = config {
// calculate defaults
let x = default_x_y_z;
Builder::builder().with().arguments()
} else {
Builder::builder().default().if().no().config().passed()
}
This branch has not been deployed
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.
build_memoryin factor of defaulting to in-memory databases and allowing.database(path)to be passedbuild_memoryandopen_dbclient.rsto not branch into multiple builders.Should be no breaking changes (though obviously httpcache is 'touched', and should be covered by tests).
Pull Request checklist
[ci full]to the PR title.