Closed ClementDelgrange closed 11 months ago
Hello @kwasniew @sighphyre , I saw you were active recently on other pull requests. Is there any chance you could take a look at this one? Please let me know if you need more information or if you'd like me to open an issue to discuss the problem I'm facing.
Hey @ClementDelgrange we'll try to handle this PR soon.
Description
This commit https://github.com/Unleash/unleash-client-python/commit/0e7b894851c5a9bec69e9926fcc07a87250fb958 introduced a new method:
Feature._get_evaluation_result(context) -> EvaluationResult
. This method is used for instance to determine whether a feature is enabled or not. If there are strategies associated to the feature, this method makes a call tostrategy.execute(context)
and another toenabled_strategy.get_result(context)
that itself callsself.execute(context)
. In the end,Strategy.execute()
is called two times which is an issue in the case of aGradualRolloutRandom
because a new random integer is compared each time to the rollout percentage.Steps to follow to highlight the issue:
api_token = "..." client = UnleashClient( url="https://app.unleash-hosted.com/demo/api/", app_name="my_python_app", custom_headers={"Authorization": api_token} ) client.initialize_client()
total_enabled = sum(client.is_enabled("f-random-stickiness") for i in range(1000))
print(total_enabled) # 228