Skip to content

Commit 751684d

Browse files
Reset backoff when connectivity status changes (#1706)
1 parent 0eaca5e commit 751684d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

firebase-firestore/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Unreleased
2+
- [fixed] Removed a delay that may have prevented Firestore from immediately
3+
reestablishing a network connection if a connectivity change occurred while
4+
the app was in the background.
25
- [fixed] Fixed an issue that may have prevented the client from connecting
36
to the backend immediately after a user signed in.
47

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ public void onClose(Status status) {
211211
(NetworkStatus networkStatus) -> {
212212
workerQueue.enqueueAndForget(
213213
() -> {
214+
// Porting Note: Unlike iOS, `restartNetwork()` is called even when the network
215+
// becomes unreachable as we don't have any other way to tear down our streams.
216+
214217
// If the network has been explicitly disabled, make sure we don't accidentally
215218
// re-enable it.
216219
if (canUseNetwork()) {
@@ -277,6 +280,8 @@ private void restartNetwork() {
277280
networkEnabled = false;
278281
disableNetworkInternal();
279282
onlineStateTracker.updateState(OnlineState.UNKNOWN);
283+
writeStream.inhibitBackoff();
284+
watchStream.inhibitBackoff();
280285
enableNetwork();
281286
}
282287

0 commit comments

Comments
 (0)