Skip to content
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

Optimization: fetchFlags() sending an API request even when the context hasn't changed #12

Open
thomas-herbeth-srp opened this issue May 16, 2024 · 1 comment

Comments

@thomas-herbeth-srp
Copy link

Flagship Version:
3.1.0
Bucketing mode

Hello.
We have noticed an intriguing behavior when updating the Flagship context.
Let's suppose we have this context: {"foo": "foo", "bar": "bar"}
And we update the context like so:

suspend fun updateContext(context: HashMap<String, Any>) {
    visitor.updateContext(context)
    visitor.fetchFlags().await()
}

updateContext(hashMapOf("foo" to "foo"))

Then we can see in the logs that fetchFlags() sends an API request to https://decision.flagship.io/v2/xxxxx/events, even though the context hasn't changed.

It doesn't look like fetchFlags() checks for context modification (visitor.flagFetchingStatus) before sending the API request, so it sends requests that are not necessary:

Would it be possible to optimize fetchFlags() to only update flags when necessary, or add restrictions to avoid sending too many API requests?
Thanks.

@raf-abtasty
Copy link
Collaborator

Hi @thomas-herbeth-srp thx for your feedback, good news this improvement is already planed in our roadmap. No ETA yet stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants