Hi with regards to python sdk, I see this example:...
# announcements
c
Hi with regards to python sdk, I see this example:
Copy code
gb = GrowthBook(
  api_host = "<https://cdn.growthbook.io>",
  client_key = "sdk-abc123",
  # How long to cache features in seconds (Optional, default 60s)
  cache_ttl = 60,
)
gb.load_features()
Question: So let's say my app started I called gb.load_features() and after 5 minutes I went and update configuration of a feature, will growthbook sdk know to get an update or is it trusting me to keep call gb.load_features() periodically?
h
The latter. Only JS/React and I believe Java currently support streaming updates (i.e. feature/experiment updates). Streaming updates for more platforms is coming soon!
👍 1
l
@happy-autumn-40938 To clarify on the same note, for React/JS SDKs, the worst case scenario for an update to be reflected live will be 60 seconds right? Or does this depend if
autoRefresh
is set to
true
or not?
h
For JS/React, if you have streaming turned off (autoRefresh: false) then the TTL will be the minimum staleness (age) of your cached features. So if you call
loadFeatures
before the TTL expires, the SDK will just used the cached copy instead of fetching new features. You can override the TTL to not be 60 seconds, ex:
configureCache({staleTTL: 5000})
. However, without streaming, the SDK will keep stale results indefinitely until something triggers a refetch (i.e. a user triggering another
loadFeatures
call). With streaming enabled, none of this matters because the SDK will get instant feature updates from the server, which bypasses the cache/TTL logic entirely and re-seeds your SDK cache.
👍 1