0
votes

I am new in using Firebase Remote Config, so I am trying to figure out how it works. from the documentation here https://firebase.google.com/docs/remote-config/use-config-android#policies_and_limits. it is said:

The default minimum fetch interval for Remote Config is 12 hours, which means that configs won't be fetched from the backend more than once in a 12 hour window, regardless of how many fetch calls are actually made

but I am confused why right after I change the parameter value and publish it via firebase console, then it will always give immediate effect on the client side. currently I am using Android. and here is the code on my Android App:

first, I set up the default value:

        private var remoteConfig = FirebaseRemoteConfig.getInstance()

        // set remote config default value
        val default : HashMap<String,Any> = hashMapOf(
            REMOTE_CONFIG_ALLOWABLE_APP_VERSIONS to "[${BuildConfig.VERSION_NAME}]",
            REMORE_CONFIG_NUMBER_OF_DOCUMENTS_PER_PAGE to 15
        )

        remoteConfig.setDefaultsAsync(default)

and then I fetch and activate data using this:

        remoteConfig.fetchAndActivate().addOnSuccessListener {
            checkAppVersion()
        }.addOnFailureListener {
            mActivity.toast("Failed to get configuration data")
        }

I don't set FirebaseRemoteConfigSettings.Builder.setMinimumFetchIntervalInSeconds(long) in my code above, so I assume the minimum fetch interval is determined by the default value of 12 hours.

so after changing the parameter value from firebase console and publish it, I assume this line will not be triggered.

remoteConfig.fetchAndActivate().addOnSuccessListener {
   // the code inside here will not be triggered ?
   // I assume the code in here will not be triggered if last time fetch is not more than 12 hours
}

is this a correct behaviour ? or do I make something wrong ? actually I am happy if it can give immediate effect on the client side, but if I read the documentation, there is a throttling issue. so I am worried I will get exception because of throttling, because it seems I fetch data over and over again

previously, indeed I use this setting configuration:

remoteConfig = FirebaseRemoteConfig.getInstance()
val configSettings = FirebaseRemoteConfigSettings.Builder()
        .setMinimumFetchIntervalInSeconds(0)
        .build()
remoteConfig.setConfigSettingsAsync(configSettings)

but after I am satisfied with developing mode, then I remove that config settings. and I hope I will refetch data from 12 hours default value

is this give an effect ? cached or something ?

CASE CLOSED: after uninstalling the app, then my app behaves like I expect. maybe .setMinimumFetchIntervalInSeconds(0) is also cached. even though I have removed it, it still behaves like that.

1

1 Answers

0
votes

If you are not using setMinimumFetchIntervalInSeconds, then I would expect two consecutive calls to fetch to return the exact same data. It maintains an internal cache. You should not see any changes made in the console between the first and second fetch (unless you crossed a 12 hour boundary).

If you are using setMinimumFetchIntervalInSeconds(0), then I would expect two consecutive calls to fetch to actually fetch a new set of results from the console, if you changed any value between them.

If you have specific reproduction examples that demonstrate otherwise, please file an issue with Firebase support.