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

Remote Config fetchAndActivate does not honour minimumFetchInterval in RemoteConfigSettings #4740

Closed
yliu342 opened this issue Jan 24, 2020 · 10 comments · Fixed by #5600
Closed
Assignees
Milestone

Comments

@yliu342
Copy link

yliu342 commented Jan 24, 2020

[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
      ....
})
@google-oss-bot

This comment has been minimized.

@yliu342
Copy link
Author

yliu342 commented Jan 24, 2020

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?

@dmandar
Copy link
Contributor

dmandar commented Jan 31, 2020

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

@toandk
Copy link

toandk commented Feb 6, 2020

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

@dmandar
Copy link
Contributor

dmandar commented Mar 13, 2020

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

@RahathCherukuri
Copy link

RahathCherukuri commented Apr 23, 2020

@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.

@jyothishd
Copy link

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.

@paulb777
Copy link
Member

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.

@mlachmish
Copy link

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

@jhandguy
Copy link

jhandguy commented Jun 8, 2020

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

@firebase firebase locked and limited conversation to collaborators Jun 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants