-
Notifications
You must be signed in to change notification settings - Fork 898
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
Support restart of FirestoreClient #8430
Conversation
🦋 Changeset detectedLatest commit: 8eaee68 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1This report is too large (967,691 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.Test Logs |
…to tomandersen/restartFirestoreClient
…to tomandersen/restartFirestoreClient
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.
Please add a changeset and a PR description based on the template. Thanks!
Drive-by comment: Could you add a blurb to this PR description to explain why this change is being made? Is it fixing a bug? Is it setting the stage for a new feature? Is it a performance improvement? Thanks. |
This PR is purely a refactor, since restart functionality is not exposed in API surface, but simply prepares for future development of features.
Currently, the FirestoreClient becomes unusable when terminated. Certain functionality, such as clearing the cache, require the FirestoreClient be terminated. This presents a problem when Firestore backend requires clearing of cache on client, since this will break customer applications. This PR makes it possible to restart the client after terminate, thereby allowing usage of Firestore to continue even after cache is cleared.
To support restarting FirestoreClient:
ensureFirestoreConfigured
code path. To support existing behaviour of preventing Firestore usage after terminate, theensureFirestoreConfigured
method has guard added to check whether a_terminated
task exists._terminated
task, such thatensureFirestoreConfigured
no longer prevents instantiating new client after terminate. With both the reference to_firestoreClient
and_termianted
being reset toundefined
, the system appears fresh, ready to create a new firestore instance. By having the old AsyncQueue chained to new AsyncQueue, no processing will happen on new firestore instance, until all processing on old firestore instance is complete, thereby avoiding any interference between the old and new firestore instance.