为什么如果我在 Firebase 远程配置控制台上更改参数值,它会立即在客户端生效?这是正确的行为吗?

Why if I change parameter value on Firebase Remote Config console, it will give immediate effect on client side ? is this a correct behaviour?

我是 Firebase 远程配置的新手,所以我想弄清楚它是如何工作的。来自这里的文档 https://firebase.google.com/docs/remote-config/use-config-android#policies_and_limits。据说:

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

但我很困惑,为什么在我更改参数值并通过 firebase 控制台发布后,它总是在客户端立即生效。目前我正在使用 Android。这是我的 Android 应用程序中的代码:

首先,我设置了默认值:

        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)

然后我使用这个获取并激活数据:

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

我在上面的代码中没有设置 FirebaseRemoteConfigSettings.Builder.setMinimumFetchIntervalInSeconds(long),所以我假设最小提取间隔由默认值 12 小时决定。

所以在从 firebase 控制台更改参数值并发布后,我假设不会触发此行。

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
}

这是正确的行为吗?还是我做错了什么?实际上,如果它能在客户端立即生效,我很高兴,但是如果我阅读文档,就会出现节流问题。所以我担心我会因为节流而出现异常,因为我似乎一遍又一遍地获取数据

之前确实是我用的这个设置配置:

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

但在我对开发模式感到满意之后,我删除了该配置设置。我希望我能从 12 小时默认值

重新获取数据

这个有效果吗?缓存什么的?

案例结束:卸载应用程序后,我的应用程序的行为与我预期的一样。也许 .setMinimumFetchIntervalInSeconds(0) 也被缓存了。即使我已经删除了它,它仍然表现得像那样。

如果您没有使用 setMinimumFetchIntervalInSeconds,那么我希望连续两次调用可以获取 return 完全相同的数据。它维护一个内部缓存。您应该看不到在第一次和第二次提取之间在控制台中所做的任何更改(除非您超过了 12 小时的界限)。

如果您正在使用 setMinimumFetchIntervalInSeconds(0),那么如果您更改了它们之间的任何值,我希望连续两次调用 fetch 以实际从控制台获取一组新结果。

如果您有具体的复制示例可以证明并非如此,请file an issue with Firebase support