-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hello!
When I set a low cache_ttl, get a FF value, sleep for a while, then get the value again, I don't get the latest value, I just get what was cached. This behaviour seems wrong, and isn't consistent with the Growthbook client
To put the above words into code:
# When running this, don't forget to define GB_API_HOST and GB_CLIENT_KEY
import time
from openfeature import api as openfeature_api
from growthbook_openfeature_provider import (
GrowthBookProvider,
GrowthBookProviderOptions,
)
gb_openfeature_provider = GrowthBookProvider(
GrowthBookProviderOptions(
api_host=GB_API_HOST,
client_key=GB_CLIENT_KEY,
cache_ttl=1,
qa_mode=True,
enabled=True,
)
)
gb_openfeature_provider.initialize_sync()
openfeature_api.set_provider(gb_openfeature_provider)
gb_of_client = openfeature_api.get_client()
# make sure my-flag exists in growthbook
first_result = gb_of_client.get_boolean_value("my_flag", False)
time.sleep(15) # update the value in the UI.
second_result = gb_of_client.get_boolean_value("my_flag", False)
assert first_result != second_result, "We slept much longer than the cache ttl, should get latest value"Should the above example work, or have I misunderstood the API?
I have a test repo here that compares the GrowthBook client with OpenFeature using the GrowthBook provider: https://github.com/isthisnagee/growthbook-openfeature-provider-python-issue
In the example above, the GrowthBook client gets the latest value after the sleep call, but the openfeature provider doesn't.
Thanks!!
Metadata
Metadata
Assignees
Labels
No labels