Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Updated feature flag values don't always get updated on initialization #110

Open
markanderson-underdog opened this issue Feb 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@markanderson-underdog
Copy link

markanderson-underdog commented Feb 22, 2024

Platform

iOS

Platform Version

iOS 17.2

Braze SDK Version

7.5.0

Xcode Version

15.2

Computer Processor

Apple (M1)

Repro Rate

80% of the time

Steps To Reproduce

  1. Configure a remote feature flag in Braze
  2. Set the rollout of the Feature Flag to e.g. 100% / ON
  3. Launch app, which inits Braze and receives value of the flag
  4. Set rollout of the feature flag to 0% / OFF
  5. Kill + relaunch the app, re-initing Braze to receive value of the flag

Expected Behavior

After step 5, new Feature Flag value (off) is respected and given to the application on init-ing Braze

Actual Incorrect Behavior

I can see in a Network Proxy tool that the Braze SDK is indeed fetching the new FF and it is received as off from the API, often (~80%) the Braze SDK inits before the API response comes in to update the FF value, and as a result the incorrect value of ON is given to the app on init.

See attached images, taken around step 5 of the STR:
First image - Braze is initialized, and we check the feature flags (shows the flag is ON, even though the flag is set to OFF on the backend)
Screenshot 2024-02-21 at 2 10 46 PM
Second image - about ~350 ms later, the braze request to sync the flags returns, and shows no flags (which is correct)
Screenshot 2024-02-21 at 2 10 37 PM
Third image - almost 1 second later, if we re-query the flags, we're finally shown correct state
Screenshot 2024-02-21 at 2 10 52 PM

Verbose Logs

No response

Additional Information

No response

@markanderson-underdog markanderson-underdog added the bug Something isn't working label Feb 22, 2024
@jerielng
Copy link
Collaborator

Hi @markanderson-underdog, thanks for raising this. If I understand correctly, you are receiving the 100%-on value at your first launch of the app, and then while the app is still opened, turning it to 0% remotely before quitting and re-opening? Are you re-syncing your feature flags before killing the app?

I believe that should be expected behavior, unless I've misrepresented the above scenario? Feature flag values are only refreshed whenever that /feature_flags/sync API call is made. If no refresh call is made between steps 4 and 5, the Braze SDK will be re-initialized upon launch with whatever cached values there were from the previous sync. When the SDK is initialized, it kicks off a refresh call as soon as it can, but until that refresh call returns, it has no knowledge of the server's last state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants