Skip to content

Commit 63befa9

Browse files
Merge 0ed3a53 into f8d1b3d
2 parents f8d1b3d + 0ed3a53 commit 63befa9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.changeset/thick-rabbits-guess.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"firebase": patch
3+
"@firebase/firestore": patch
4+
---
5+
6+
[fixed] Removed a delay that may have prevented Firestore from immediately
7+
reestablishing a network connection if a connectivity change occurred while
8+
the app was in the background.

packages/firestore/src/remote/remote_store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,11 @@ export class RemoteStore implements TargetMetadataProvider {
153153
connectivityMonitor: ConnectivityMonitor
154154
) {
155155
this.connectivityMonitor = connectivityMonitor;
156-
this.connectivityMonitor.addCallback((status: NetworkStatus) => {
156+
this.connectivityMonitor.addCallback((_: NetworkStatus) => {
157157
asyncQueue.enqueueAndForget(async () => {
158+
// Porting Note: Unlike iOS, `restartNetwork()` is called even when the
159+
// network becomes unreachable as we don't have any other way to tear
160+
// down our streams.
158161
if (this.canUseNetwork()) {
159162
logDebug(
160163
LOG_TAG,
@@ -761,6 +764,8 @@ export class RemoteStore implements TargetMetadataProvider {
761764
this.offlineCauses.add(OfflineCause.ConnectivityChange);
762765
await this.disableNetworkInternal();
763766
this.onlineStateTracker.set(OnlineState.Unknown);
767+
this.writeStream.inhibitBackoff();
768+
this.watchStream.inhibitBackoff();
764769
this.offlineCauses.delete(OfflineCause.ConnectivityChange);
765770
await this.enableNetworkInternal();
766771
}

0 commit comments

Comments
 (0)