Firebase remote config cache expiration time in release
Asked Answered
A

1

20

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

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

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

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?

Acord answered 28/7, 2016 at 10:37 Comment(1)
The blog post link below has answers to all your questions. The default cache time is 12 hours. setDeveloperModeEnabled(true) will work only for up to 10 devices before you start getting throttled from server side. Refer: firebase.googleblog.com/2017/01/…Villada
N
36

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.

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.

Nolpros answered 28/7, 2016 at 14:26 Comment(4)
The documentation now backs the 5 requests per hour claim: "Throttling is done from within the SDK. An app can fetch a maximum of 5 times in a 60 minute window before the SDK begins to throttle and returns FirebaseRemoteConfigFetchThrottledException."Omnidirectional
They have since changed their mind: "Before SDK version 6.3.0, the limit was 5 fetch requests in a 60 minute window (newer versions have more permissive limits)"Gobbet
Do you know if these "5 fetchs in 60 minutes" is counted by all calls from my app in all devices or the counter is for each device with the app installed?Despotic
I would like to know that as well, do any one seems to know that?Hydrops

© 2022 - 2024 — McMap. All rights reserved.