Refactors locks in AdsClient to avoid requirements of universal locks - #7627
Open
thesuzerain wants to merge 8 commits into
Open
thesuzerain wants to merge 8 commits into
thesuzerain wants to merge 8 commits into
Conversation
thesuzerain
commented
Sep 25, 2026
| } | ||
|
|
||
| #[derive(Clone)] | ||
| pub struct WrappedHttpCache(Option<Arc<Mutex<Option<HttpCache>>>>); |
Collaborator
Author
There was a problem hiding this comment.
This impl is a bit over the top and something I may not keep, I just didn't like the Option<...<Option<...>> and the nested structures it required to get locks. This lets us treat the double option as a single option. I think this is uglier actually. I'm considering a couple options before I PR this:
Arc<Mutex<Option<HttpCache>>>and get a lock every time even if HttpCache is unset.Option<Arc<Mutex<Option<HttpCache>>>>and keep the nestedOptionhandling.
Either way this code snippet is not the critical part of this refactor. However, we do need to pass this mutex 'up and out' to the AdsClient test shutdown_does_not_require_http_client_lock
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.
This restructure allows us to avoid having to lock the entire
AdsClient, but only restricts locks to what we specifically need- in this case, HttpCache.This allows:
Pull Request checklist
[ci full]to the PR title.