I’ve encountered one feature of the segments, and I can’t figure out yet whether this behavior is normal or not.
Once the segment has been created and added for use by the flag, everything
is ok, but when I make changes to the segment already used, they only work after I delete and add the same segment for the flag again. At the same time, enabling and disabling Default Rollout is applied immediately (True/False).
Should a segment update work on the fly, or is it only updated when Rollouts are added? (I’m using the client-side SDK)
Hi there. Sorry you are running into issues with stale segments in evaluation.
Updating segments should work on the fly, or at least will on the next poll from the client SDK.
Are you able to give more examples like what you are updating in the segment? And/or can you share an export of your flags/segments so that we can help debug?
If I set the value ttl: 60s
I expect that after editing a segment my changes will be applied immediately or after 60 seconds after clearing cache, but it doesn’t happen after 60 or 5 minutes. The client still uses old values until browser cache is reset.
If I set the value ttl: 10s it works 50/50.
There is nothing suspicious in the Flipt logs, entries in Redis are created and deleted in a timely manner.
So one thing to note is cache isn’t really necessary for Client Side SDKs as the state that is served to the clients is already loaded in memory on the server.
Cache is really only relevant if you are doing evaluation on the Flipt Server for each request, like if you are using one of our Server SDKs.
So the caching configuration part of this might be a red herring as I don’t think its contributing to the issue of stale data in the React SDK.
Are you using the latest version of the React SDK? or at least v0.1.0 ? There was quite a bit of rework in 0.1.0 that should make the state more… reactive and prevent the need from having to reload the browser to get state changes.
Yes, I’m using version 0.1.0 (I saw that version 0.2.0 was recently released) and everything works fine with the Flipt cache disabled. I was just wondering why this behavior with cache enabled. Thank you for the explanation!