Skip to content

[Firestore] Connection not recovering quickly after being offline #204

@ryanjohn1

Description

@ryanjohn1

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.2.1
  • Firebase Component: Firestore
  • Component version: 17.1.5

[REQUIRED] Step 3: Describe the problem

Firestore currently has an exponential backoff mechanism to prevent reduce wasted resources when an internet connection is lost. The issue is that it can take a long time to come back when the connection is re-established, usually over a minute.
This is especially jarring to the user when their connection comes back so that they get a push notification to inform them of something new (say a message in a chat app), they tap the notification and the screen loads but the message they were just informed about does not arrive through the snapshot listener. If they sit on the screen for a minute or two (very unlikely) then their message will eventually load. This leaves them feeling the product is broken.

I'd seen in the changelog a comment that seems to suggest work has been done on this issue but I'm still seeing similar behaviour. Our iOS client improved dramatically with the equivalent recent change with the message arriving in 0-10 seconds after the internet connection is reestablished.

Steps to reproduce:

  1. Add a snapshot listener to some data on Firestore, ensure the data is coming through correctly when data is changed.
  2. Turn the device to airplane mode to kill the internet connection
  3. Change the data on Firestore
  4. Wait 2 minutes
  5. Turn airplane mode off
  6. (Open app if closed) time how long the changed data takes to arrive

Expected: data arrives within a few seconds after the internet connection is reestablished
Actual: data arrives after 30s to 2mins after internet connection is reestablished

The same behaviour occurs whether or not you stay in the app with the listener attached or remove the listener and background the app. Killing the app completely causes the expected result to occur.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions