-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat: Set Unleash changed flags on change event. #724
Conversation
Signed-off-by: rafearnold <[email protected]>
hi @RafeArnold thanks for the changes, looks good. |
The background for this change is that being able to see which flags have actually been updated when a I've realised that my implementation isn't actually doing what I intended, since the ToggleResponse will contain all the feature toggles available, not just the updated ones. I guess the subscriber wrapper would require a cache of the flag keys that it could compare and update with the flags that were retrieved from the Unleash API. I'll have another crack at it and see what I can produce. |
Having thought about it further, to implement my intention, I believe the subscriber wrapper would need to keep its own cache of all the flags, which feels like a huge waste of resources. If this is the case, having the event receivers perform the checks themselves seems like the best option. Feel free to close this PR, unless a better solution can be thought of. |
@@ -69,7 +72,12 @@ public void toggleEvaluated(ToggleEvaluated toggleEvaluated) { | |||
public void togglesFetched(FeatureToggleResponse toggleResponse) { | |||
unleashSubscriber.togglesFetched(toggleResponse); | |||
if (FeatureToggleResponse.Status.CHANGED.equals(toggleResponse.getStatus())) { | |||
List<String> flagsChanged = new ArrayList<>(); | |||
for (FeatureToggle featureToggle : toggleResponse.getToggleCollection().getFeatures()) { |
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.
What does toggleResponse.getToggleCollection().getFeatures() contain ?
Only changed features ?
Any documentation reference from Unleash ?
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.
Yeah, unfortunately, as per my other comment, it contains all the feature toggles available from the Unleash API, not just the changed ones, so this implementation doesn't work as intended.
…ure#724) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This PR
Notes
This addition makes checking which flags have updated trivial for the end-user.