firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Can't setup fetchTimeout on RemoteConfigSettings

Open MaksimBezdrobnoi opened this issue 1 year ago • 5 comments

Description

Firebase doesn't use fetchTimeout settings. Looks like he setup it, but doesn't use

Reproducing the issue

Setup IPhone internet connection Go to Settings -> Developer -> Network Link Conditioner -> 100% Loss

Setup FirebaseApp

public init() {
        if FirebaseApp.app() == nil {
            FirebaseApp.configure()
        }

        let settings = RemoteConfigSettings()
        settings.minimumFetchInterval = 2 * 60 * 60
        settings.fetchTimeout = 30
        remoteConfig = .remoteConfig()
        remoteConfig.configSettings = settings
        super.init()

        Messaging.messaging().delegate = self

Use fetchRemoteConfig:

func fetchRemoteConfigurationPayload(
    ) -> AnyPublisher<RemoteConfigurationPayload, Never> {
        let remoteConfig = self
        return Future<ConfigurationFetchPayload, Never> { [remoteConfig] promise in

            remoteConfig.fetch { status, error in
....

And if we will use prints inside Future fuction we will receive correct FetchTimeout print("SETTINGS FETCHTIMEOUT =>", remoteConfig.configSettings.fetchTimeout)

But in real - Firebase still use 1 minuted timeOut

Firebase SDK Version

11.1.0

Xcode Version

16.0

Installation Method

Swift Package Manager

Firebase Product(s)

Remote Config

Targeted Platforms

iOS

Relevant Log Output

MaksimBezdrobnoi avatar Oct 04 '24 07:10 MaksimBezdrobnoi

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Oct 04 '24 07:10 google-oss-bot

Thanks for reporting, @MaksimBezdrobnoi. Upon testing, the issue is only reproducible when the app is just installed without internet connection. May I know if this is the same behavior you did to reproduce the issue?

rizafran avatar Oct 07 '24 17:10 rizafran

Same scenario is occurring on my side On the very first opening RemoteConfig handler never call back. User has to kill and then reopen the app.

nomimalik1769 avatar Oct 08 '24 06:10 nomimalik1769

@rizafran Yes, it only reproduces when the app is just installed. It makes sense, but interesting why it can't use my fetchTimeout from the start (when the app has just been installed)

MaksimBezdrobnoi avatar Oct 08 '24 09:10 MaksimBezdrobnoi

Thanks for confirming, @MaksimBezdrobnoi. I'll raise it to our engineers to see if it's a bug or intended.

rizafran avatar Oct 10 '24 12:10 rizafran

I have the same issue, the same 11.1.0 version but Xcode 15.4

gerchicov-vg avatar Nov 04 '24 12:11 gerchicov-vg

Hi there, I believe I solved the issue after being able to reproduce it. The line remoteConfig = .remoteConfig() was overwriting the existing global instance, resetting your settings. I fixed it by ensuring the existing instance is configured directly, so your changes are applied consistently. it should ideally just look like this:

let settings = RemoteConfigSettings()
    settings.minimumFetchInterval = 2 * 60 * 60
    settings.fetchTimeout = 30
    
    remoteConfig.configSettings = settings

In my test case, I used 30 in fetchTimeout and using Network Link Conditioner on 100% loss and the print statements came back with 30 being used.

I also wrapped it into a setupDefaults() function that I called after FirebaseApp.configure(). Please let me know if this fixes it for you!

MichaelVerdon avatar Dec 02 '24 13:12 MichaelVerdon

Hey @MaksimBezdrobnoi. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Dec 09 '24 02:12 google-oss-bot