-
Notifications
You must be signed in to change notification settings - Fork 55
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
Avoid fetching feature again in GetVariant #161
Comments
If you're generally okay with the proposed solution I'm fine submitting a PR myself. |
Hey, @jameshartig! Thanks for the issue. I know you've got a few of them open (this one, #162, and #160), so permit me to briefly talk to you here for some info. Are they all still relevant after your merging of #164? Regarding this one specifically: For clarity, do you mean that whenever you call |
Yes, #160 is a bug with either the documentation or in the code but I'm not sure which. #162 is a feature request.
Yes, I understand it doesn't do another network lookup, but it does call |
Previously GetVariant would do 2 storage.Get calls which might be costly depending on the implementation. It doesn't need to do the second one if we just return the feature from isEnabled. Fixes Unleash#161
Great; thanks! 🙏🏼 It appears that #162 has been resolved and that you have a PR in the works for this one that @FredrikOseberg has said he'll have a look at, so that's sorted. Regarding #160, I think it's the documentation that's unclear (but I'll double check against the implementations in the other SDKs). And while I think you're right in that it's at least misleading, it could be read as being correct: if the flag exists, then you'll always find a variant (even if it's the disabled variant), so the only time the sdk won't be able to find the variant is if the flag is missing. However, that is not at all obvious and the names can certainly be misleading. I'll add it as a thing to solve and see if we can tackle it shortly. |
Previously GetVariant would do 2 storage.Get calls which might be costly depending on the implementation. It doesn't need to do the second one if we just return the feature from isEnabled. Fixes #161
Describe the feature request
Currently
GetVariant
callsisEnabled
and then uses a custom resolver orgetToggle
to fetch the feature immediately afterwards.Background
We are starting to use the Unleash client in very performance-sensitive places and we notied this inefficiency in testing when we noticed our custom resolver being called twice.
Solution suggestions
Ideally
StrategyResult
could contain theFeature
so thatGetVariant
doesn't have to fetch it again. I do realize this is probably a small perf improvement but it seems simple.The text was updated successfully, but these errors were encountered: