optimizely / android-sdk

Android SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/android-sdk
Apache License 2.0
55 stars 39 forks source link

[BUG] Setting initialize()'s updateConfigOnNewDatafile=false is ignored by DefaultDatafileHandler #472

Closed haroldteramotosonos closed 8 months ago

haroldteramotosonos commented 8 months ago

Is there an existing issue for this?

SDK Version

3.13.4

Current Behavior

Initializing OptimizelyManager.initialize with updateConfigOnNewDatafile set to false is ignored by DefaultDatafileHandler. DefaultDatafileHandler will still call enableUpdateConfigOnNewDatafile() regardless of the value of updateConfigOnNewDatafile and updates the configuration when the new datafile is downloaded.

Expected Behavior

When updateConfigOnNewDatafile set to false, configuration is not updated as stated in the documentation.

Steps To Reproduce

  1. Initialize OptimizelyManager with 1 minute interval.
  2. Call initialize() with updateConfigOnNewDatafile set to false
  3. Change the flag to a different value from default.
  4. Wait for at least 15 minutes for Optimizely to download the updated datafile.

Expected:

Actual:

Link

No response

Logs

No response

Severity

Minor issue

Workaround/Solution

Workaround that we implemented: Subclass from DefaultDatafileHandler and overrode enableUpdateConfigOnNewDatafile() and make it a no-op.

Recent Change

No response

Conflicts

No response

muzahidul-opti commented 8 months ago

Hi @haroldteramotosonos thanks for raising the ticket. Which initialization approach did you follow? I mean synchronous or asynchronous.

haroldteramotosonos commented 8 months ago

We use synchronous initialization. Apologies for missing that information.

We call the initialize() API like following, which defaults the updateConfigOnNewDatafile as false.

client = manager.initialize(context, R.raw.optimizely_bundled_datafile)
haroldteramotosonos commented 8 months ago

I just checked the Swift SDK documentation and I see this in the doc.

If you have datafile polling enabled, the Swift SDK automatically updates when a new datafile is detected to ensure that you are always working with the latest datafile.

Swift Usage Notes

However, on the Android documentation, this behavior is not documented. Android Usage Notes

Could this be a documentation error, rather than the software defect?

muzahidul-opti commented 8 months ago

Hi @haroldteramotosonos, I really appreciate your effort. You are correct. If the datafileDownloadInterval value is greater than 0, then datafileDownloadEnabled becomes true, and the SDK automatically downloads the latest data file.

We will update our doc very soon.

Thank you.

haroldteramotosonos commented 8 months ago

Thank you @muzahidul-opti for the clarification! I will close this issue.