fix(remote-config,ios): fixed fetch throttling issue #4664
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As per documentation, apps must be very gentle when it comes to fetching from the Firebase Remote Config storage. By default, it happens not more often than once in 12 hours. For that the library provides a selector:
fetchWithCompletionHandler:
that doesn't have the time interval parameter and uses the value from settings and the second onefetchWithExpirationDuration:completionHandler:
that allows to override this configuration. In JS it is exposed as a single method of signaturefetch(expirationDurationSeconds?: number): Promise<void>;
. WhenexpirationDurationSeconds
is undefined, -1 is passed to the native module and then treated as follows:The problem here is that an
NSNumber
instance is compared by reference with anotherNSNumber
instance (yet holding the same value) which always fails, leading to theelse
path always executed. And internally in the FirebaseRemoteConfig SDK-1
is going to be treated same as0
in such a way that no limitation on fetching will be applied, resulting in almost immediate throttling unleashed by the server.This PR mitigates this issue and allows to fetch the remote config without the risk of throttling.
Checklist
Android
iOS
e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
🔥