-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: allow multiple client tokens at startup #188
Conversation
@@ -145,12 +145,8 @@ impl FeatureRefresher { | |||
} | |||
|
|||
/// | |||
/// Registers a token for refresh, returns true if token did not exist and as such needs hydration before we can guarantee that we have data for it |
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.
Patches to this function are just for sanity. The doc string got outdated here and we never updated it. This function could also never fail - there was no path to raise an error but the function signature suggested that it could, so now the return signature reflects that . You'll see a few places in this PR where
let _ = feature_refresher
has been swapped for feature_refresher
, which is married to the change to this function
.collect() | ||
} | ||
|
||
fn filter_unique_tokens(tokens: &[TokenRefresh]) -> Vec<TokenRefresh> { |
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.
The TokenRefresh type already has a Hash impl, so we gotta go the long way around to make a unique list here
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.
I think this looks fine, especially the test case gives me confidence that this is the right thing to do 👍
Me too - that's why we write tests haha |
Fixes an issue where providing multiple tokens on startup with identical environments and projects would result in no tokens being registered.
This was caused by overeager subsumption of the tokens - identical tokens would subsume each other, and therefore the result of two identical tokens would be no tokens. I've patched this by creating a new list of only tokens that do not have a match for identical project/environment before we do the subsumption.