Skip to content

Commit

Permalink
Merge 0ed3a53 into f8d1b3d
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Jul 7, 2020
2 parents f8d1b3d + 0ed3a53 commit 63befa9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changeset/thick-rabbits-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"firebase": patch
"@firebase/firestore": patch
---

[fixed] Removed a delay that may have prevented Firestore from immediately
reestablishing a network connection if a connectivity change occurred while
the app was in the background.
7 changes: 6 additions & 1 deletion packages/firestore/src/remote/remote_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ export class RemoteStore implements TargetMetadataProvider {
connectivityMonitor: ConnectivityMonitor
) {
this.connectivityMonitor = connectivityMonitor;
this.connectivityMonitor.addCallback((status: NetworkStatus) => {
this.connectivityMonitor.addCallback((_: NetworkStatus) => {
asyncQueue.enqueueAndForget(async () => {
// Porting Note: Unlike iOS, `restartNetwork()` is called even when the
// network becomes unreachable as we don't have any other way to tear
// down our streams.
if (this.canUseNetwork()) {
logDebug(
LOG_TAG,
Expand Down Expand Up @@ -761,6 +764,8 @@ export class RemoteStore implements TargetMetadataProvider {
this.offlineCauses.add(OfflineCause.ConnectivityChange);
await this.disableNetworkInternal();
this.onlineStateTracker.set(OnlineState.Unknown);
this.writeStream.inhibitBackoff();
this.watchStream.inhibitBackoff();
this.offlineCauses.delete(OfflineCause.ConnectivityChange);
await this.enableNetworkInternal();
}
Expand Down

0 comments on commit 63befa9

Please sign in to comment.