-
Notifications
You must be signed in to change notification settings - Fork 893
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
Firestore: Enable auto-detection of long-polling networking mode #7236
Firestore: Enable auto-detection of long-polling networking mode #7236
Conversation
🦋 Changeset detectedLatest commit: e58f70b 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 |
… that its default value is now true
@@ -88,8 +88,11 @@ export interface FirestoreSettings extends LiteSettings { | |||
* detect if long-polling should be used. This is very similar to | |||
* `experimentalForceLongPolling`, but only uses long-polling if required. | |||
* | |||
* This setting will likely be enabled by default in future releases and | |||
* cannot be combined with `experimentalForceLongPolling`. | |||
* After having had a default value of `false` since its inception 4 years |
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.
Note to self: update this documentation immediately after release to mention the year "2019" instead of "4 years ago" and the actual version number instead of "the most recent release".
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.
Googlers see b/278957890 for details.
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.
Suggestion: Just say "since 2019" and say "and changed in mid 2023" so you don't need to worry about it later?
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.
Done. I still think I want to go back and change it to the specific version and release date so that customers can more easily correlate their issues with the release. But at least with your wording suggestion it's not as time-critical to get that change in.
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
…LongPolling is boolean
…LongPolling and experimentalAutoDetectLongPolling to boolean
…lines to make lint happy
…cTweak' into AutoDetectLongPollingEnabledByDefault
…ngEnabledByDefault
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 suggested a documentation edit but otherwise LGTM
@@ -88,8 +88,11 @@ export interface FirestoreSettings extends LiteSettings { | |||
* detect if long-polling should be used. This is very similar to | |||
* `experimentalForceLongPolling`, but only uses long-polling if required. | |||
* | |||
* This setting will likely be enabled by default in future releases and | |||
* cannot be combined with `experimentalForceLongPolling`. | |||
* After having had a default value of `false` since its inception 4 years |
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.
Suggestion: Just say "since 2019" and say "and changed in mid 2023" so you don't need to worry about it later?
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.
LGTM
@egilmorez Could you review for docs? |
…ngEnabledByDefault
@@ -306,13 +306,13 @@ describe('Settings', () => { | |||
expect(db._getSettings().experimentalForceLongPolling).to.be.false; | |||
}); | |||
|
|||
it('long polling should be disabled if force=false', () => { | |||
it('long polling should be in auto-detect mode if force=false', () => { | |||
// Use a new instance of Firestore in order to configure settings. | |||
const db = newTestFirestore(); | |||
db._setSettings({ | |||
experimentalForceLongPolling: false |
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.
by the looks of it, whether experimentalForceLongPolling
is set to false or not does not change the settings below (as it looks the same from the test above).
However, setting experimentalForceLongPolling
to false should actually disable auto detect long polling too, is that right?
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.
If both experimentalForceLongPolling=true
and experimentalAutoDetectLongPolling=true
then an exception will be thrown:
firebase-js-sdk/packages/firestore/test/unit/api/database.test.ts
Lines 269 to 280 in e147219
it('can not use mutually exclusive settings together', () => { | |
// Use a new instance of Firestore in order to configure settings. | |
const db = newTestFirestore(); | |
expect(() => | |
db._setSettings({ | |
experimentalForceLongPolling: true, | |
experimentalAutoDetectLongPolling: true | |
}) | |
).to.throw( | |
`experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.` | |
); | |
}); |
Those two settings are mutually exclusive. As a result, only one of forceLongPolling
and detectBufferingProxy
will be true
in WebChannelOptions
firebase-js-sdk/packages/firestore/src/platform/browser/webchannel_connection.ts
Lines 202 to 203 in e147219
forceLongPolling: this.forceLongPolling, | |
detectBufferingProxy: this.autoDetectLongPolling |
Does that address your concern?
Firestore has a setting named
experimentalAutoDetectLongPolling
which can be set totrue
to enable some heuristics to detect if enabling "long-polling" networking mode fixes communication problems with the Firestore backend servers. See #1674 for details.For the past 4 years this "auto-detect" mode was opt-in; however, we now have confidence that it is safe to enable for everyone. Therefore, this PR enables the "auto-detect" mode by default. If you are experiencing networking issues you can try disabling the long-polling auto-detection by setting
FirestoreSettings.experimentalAutoDetectLongPolling
tofalse
. If you do this, please open an issue in this GitHub repository to report your problems and mention "long-polling" in the issue title.