-
Notifications
You must be signed in to change notification settings - Fork 616
Cache FID to avoid multiple disk reads. #1571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Binary Size ReportAffected SDKs
Test Logs
NotesHead commit (50268b61) is created by Prow via merging commits: b26d198 3c974c4. |
Coverage ReportAffected SDKs
Test Logs
NotesHTML coverage reports can be produced locally with Head commit (50268b61) is created by Prow via merging commits: b26d198 3c974c4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to do all the logic inside of #doGetId
:
private String doGetId() {
// only read FID once from disk per session. Note: cachedFid will be reset if FID is deleted.
if (cachedFid != null) {
return cachedFid;
}
PersistedInstallationEntry prefs = getPrefsWithGeneratedIdMultiProcessSafe();
networkExecutor.execute(() -> doNetworkCall(false));
if (prefs.status == REGISTERED) { // pseudo-code
cachedFid = prefs.getFirebaseInstallationId();
}
return prefs.getFirebaseInstallationId();
}
...ase-installations/src/main/java/com/google/firebase/installations/FirebaseInstallations.java
Show resolved
Hide resolved
...ase-installations/src/main/java/com/google/firebase/installations/FirebaseInstallations.java
Outdated
Show resolved
Hide resolved
...ase-installations/src/main/java/com/google/firebase/installations/FirebaseInstallations.java
Outdated
Show resolved
Hide resolved
...ase-installations/src/main/java/com/google/firebase/installations/FirebaseInstallations.java
Outdated
Show resolved
Hide resolved
LGTM. PTAL - updated the PR. |
* Dropping guava and appcompat dependency from FIS SDK. * Fix OverlappingFileLockException. Access the data shared by multiple threads only after acquiring cross-process and multi-thread safe locks. * Completing getId call with the disk reads on the caller thread. Also, fixing delete API to access persisted FID using cross process safe locks. * Addressing Fred's comments * Remove unused variable * Cache FID to avoid multiple disk reads. (#1571) * Cache FID to avoid multiple disk reads. * Addressing Rayo's comments. * Addressing Rayo's comments
No description provided.