Firebase远程配置缓存在发布时的到期时间

时间:2021-07-21 20:24:27

I'm trying to setup firebase remote config for release mode by setting developer mode to false. But with cache expiration time less then 3000(may be a bit less, determined it experimentally) seconds, it fails to fetch data. It throws FirebaseRemoteConfigFetchThrottledException

我正在尝试通过将开发人员模式设置为false来为发布模式设置firebase远程配置。但是,如果缓存过期时间小于3000(可能会少一些,通过实验确定)秒,则无法获取数据。它会抛出FirebaseRemoteConfigFetchThrottledException

FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
                        .setDeveloperModeEnabled(false)
                        .build();

And with .setDeveloperModeEnabled(true) it allows me to set any time even 0 and works well.

并且使用.setDeveloperModeEnabled(true)它允许我设置任何时间甚至0并且运行良好。

Here is whole hunk:

这是整个大块头:

new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
            FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
                    .setDeveloperModeEnabled(false)
                    .build();

            mFirebaseRemoteConfig.setConfigSettings(configSettings);
            mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults);

            mFirebaseRemoteConfig.fetch(CACHE_EXPIRATION)
                    .addOnSuccessListener(new OnSuccessListener<Void>() {
                        @Override
                        public void onSuccess(Void aVoid) {
                            Log.i("info32", "remote config succeeded");
                            mFirebaseRemoteConfig.activateFetched();
                        }
                    })
                    .addOnFailureListener(new OnFailureListener() {
                        @Override
                        public void onFailure(@NonNull Exception exception) {
                            Log.i("info32", "remote config failed");
                        }
                    });
        }
    }, 0);

Could you please explain what the issue is?

你能解释一下这是什么问题吗?

1 个解决方案

#1


14  

Remote Config implements client-side throttling to prevent buggy or malicious clients from blasting the Firebase servers with high frequency fetch requests. One user has reported the limit is five requests per hour. I haven't found the limit documented anywhere, although I have confirmed that five rapid fetches will activate throttling.

远程配置实现客户端限制,以防止错误或恶意客户端使用高频获取请求爆炸Firebase服务器。一位用户报告限制是每小时五次请求。我没有在任何地方找到限制,尽管我已经确认五个快速提取将激活限制。

The caching of configuration values is explained in the documentation. Because of the throttling limits, it is not possible for your released app to immediately see changes in Remote Config values. Cached values will be used until the next fetch is allowed. The default cache expiration is 12 hours.

文档中说明了配置值的缓存。由于限制限制,您发布的应用程序无法立即看到远程配置值的更改。将使用缓存值,直到允许下一次提取。默认缓存过期时间为12小时。

#1


14  

Remote Config implements client-side throttling to prevent buggy or malicious clients from blasting the Firebase servers with high frequency fetch requests. One user has reported the limit is five requests per hour. I haven't found the limit documented anywhere, although I have confirmed that five rapid fetches will activate throttling.

远程配置实现客户端限制,以防止错误或恶意客户端使用高频获取请求爆炸Firebase服务器。一位用户报告限制是每小时五次请求。我没有在任何地方找到限制,尽管我已经确认五个快速提取将激活限制。

The caching of configuration values is explained in the documentation. Because of the throttling limits, it is not possible for your released app to immediately see changes in Remote Config values. Cached values will be used until the next fetch is allowed. The default cache expiration is 12 hours.

文档中说明了配置值的缓存。由于限制限制,您发布的应用程序无法立即看到远程配置值的更改。将使用缓存值,直到允许下一次提取。默认缓存过期时间为12小时。