-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Add #features_for_actor to return all enabled features for a given actor #783
base: main
Are you sure you want to change the base?
Add #features_for_actor to return all enabled features for a given actor #783
Conversation
@jnunemaker I'm sure there's a way to get all the enabled features for a given actor with a single call to the DB, instead of calling one by one the features with the |
@MagoMathew thanks! This looks good. I've been mostly off for the holidays. Sorry for slow response. Only thing I'm trying to decide on is if we should roll with what you have or maybe something like The other thought is maybe something that does Flipper.features_for_actor(...) but returns a Hash with each feature key as the key and true/false as the value. @bkeepers any feelings on this method name or other ideas? If not, let me know and we can just merge as is. |
Hi @jnunemaker What you propose above is actually what I needed on my project. On my actor I have this method
Do you think is a better/cleaner way to do it? |
How would this implementation work with active_record adapter? Would it fire off multiple queries to fetch all supported features? or will be done in one request? |
@skatkov if preloaded it would do minimum network calls. If not preloaded then it would be n+1. I think we could move this to adapter level as well and allow each adapter to do this more efficiently (when necessary). |
@jnunemaker would be wonderful if you can merge this PR, this can potentially solve performance issues in our app (with changes in adapter). Any chance you're planning to approve/merge this anytime soon? |
Adds #features_for_actor
With this change, you can get all features for the given actor as a param.
I've found we need that feature on my team, where we just load all the features once.
Even tho, the name could be just
features_for
but wasn't sure about it.Please feel free to share your comments and thoughts,
Probably there's a better way to do it.
Thanks for the great work.