Firebase-ios-sdk: Remote Config fetchAndActivate does not honour minimumFetchInterval in RemoteConfigSettings

Created on 24 Jan 2020  路  10Comments  路  Source: firebase/firebase-ios-sdk

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 11.3
  • Firebase SDK version: 6.14.0
  • Firebase Component: Remote Config
  • Component version: 6.14.0
  • Installation method: Carthage

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

On app launch, set minimumFetchInterval to 10 sec,
Call fetchAndActivate with a completion handler.
The first time it will always fetch from the server.
Then wait for a couple of min and re launch the app
You can see from the log
[Firebase/RemoteConfig][I-RCN000067] Successfully set configSettings. Developer Mode: false, Minimum Fetch Interval:10.000000, Fetch timeout:60.000000
[Firebase/RemoteConfig][I-RCN000051] Returning cached data.
[Firebase/RemoteConfig][I-RCN000069] Most recently fetched config is already activated.
It does not make a call to the backend to retrieve the latest Config.

The minimumFetchInterval is not taking effect.

Relevant Code:

let remoteConfig = RemoteConfig.remoteConfig()
let settings = RemoteConfigSettings()
settings.minimumFetchInterval = 10 
remoteConfig.setDefaults(fromPlist: "RemoteConfigDefault")
remoteConfig.configSettings = settings
remoteConfig.fetchAndActivate(completionHandler: { (status, error) in
      ....
})
remoteconfig

Most helpful comment

After some digging around I found out that setting the configSettings is an async call. If I make a call fetchAndActivate right after setting the configSettings then the minimumFetchInterval has not been take affect so the Default value is always used.

Not sure if this is considered as a bug or by design? If it is by design maybe update the documentation?

All 10 comments

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

After some digging around I found out that setting the configSettings is an async call. If I make a call fetchAndActivate right after setting the configSettings then the minimumFetchInterval has not been take affect so the Default value is always used.

Not sure if this is considered as a bug or by design? If it is by design maybe update the documentation?

Thanks for reporting. It makes sense for configSettings to return a completion handler. Internal bug b/148652144 tracking this.

I got the same problem. Is there any workaround solution for this issue? @dmandar @yliu342

As a workaround you can call fetchwithexpirationduration: to explicitly set the minimumfetchinterval for just that fetch call.

@dmandar: fetchwithexpirationduration too has the same behavior.
The first time it will always fetch from the server, after the elapsed duration, doesn't make a call to the backend to retrieve the latest Config.

Am also experiencing the same behavior, Only the first time the remote config is fetched from the server. Even on setting minimumFetchInterval as zero, the remote config is not fetched again from remote. It is fetched from cache only. Can this be fixed on priority.

We have a fix going into Firebase 6.25.0.

I wasn't able to reproduce the issue with the fetchwithexpirationduration: API but I believe I saw an issue with it earlier in my testing, so there could also be a separate networking or backend issue unrelated to the SDK. If you have a repro case for a failure with the API with the expirationDuration parameter, please create another issue and we'll continue to investigate.

I can confirm that the issue reproduced in Firebase 6.21.0 and has been resolved in Firebase 6.25.0

This issue is still happening for us with Firebase 6.26.0.
fetchAndActivate still ignores the minimumFetchInterval value.

Was this page helpful?
0 / 5 - 0 ratings