Doist / ffs

Feature flags solution that is fast, lean, and open-source.
http://ffs.delivery
MIT License
90 stars 6 forks source link

Make streaming opt-in, not opt-out #56

Open goncalossilva opened 2 years ago

goncalossilva commented 2 years ago

Most teams at Doist disable streaming to ensure each individual session is stable, without flag values changing at runtime. This runs counter to the current SDK default, which is to stream. Should the default be inverted?

goncalossilva commented 2 years ago

@pixyzehn @panpeter @gnapse thoughts?

gnapse commented 2 years ago

I did not even know this was a thing. Indeed, I assumed that feature flag values remained stable, and only changed on fresh page loads. We actually even cache feature flag values in memory.

I do not have strong opinions on what the default should be, as long as this setting can be set opposite to the default.

pixyzehn commented 2 years ago

From my experience on iOS, I expected that streaming is disabled unless we explicitly set it to enabled. I'm curious why the current SDK enables it by default (they even changed so starting from v5, ref), but I believe streaming can be enabled explicitly and when needed as it can be harmful and unexpected.

Another approach I see in LaunchDarkly is to allow us to subscribe flag changes for each flag, which can be flexible and explicit to developers.

panpeter commented 2 years ago

I think it's simpler if the flags are frozen and don't change values at runtime. Otherwise, as you mentioned, it's possible that the app become unstable. For example, before having frozen flags, we had one flag value when rendering UI, and then it was possible to have a different value in a view model. Obviously, that caused issues.

So I think the default should be that the streaming is disabled.

goncalossilva commented 2 years ago

The default should be the common case, so let's change it to not stream. Thanks!

I'm curious why the current SDK enables it by default

Good question. I thought I was following the standard approach, but I don't know where I got that idea from. Probably, too small of a sample size. 😅

Another approach I see in LaunchDarkly is to allow us to subscribe flag changes for each flag, which can be flexible and explicit to developers.

We can add this if it's widely useful. It would not be a complex addition.