Skip to content

FirestoreChangeListener won't receive updates after 1 hour #2536

@pauloevpr

Description

@pauloevpr

I have been facing an issue with the real time capabilities of Firestore API. I was reading Firestore documentation when I found out that user authentication tokens expire in 1 hour. This led me to the question: If the token expires in 1 hour, what happens to FirestoreChangeListener after expiration?

I then proceeded to run a simple test to find out. It turns out that FirestoreChangeListener does stop receiving updates after 1 hour. This is the test output:

9/26/2018 8:43:30 AM: Listener started
9/26/2018 8:43:30 AM: Document has changed
9/26/2018 8:43:36 AM: Document has changed // Document actually updated
9/26/2018 8:53:30 AM: Document has changed
9/26/2018 9:03:30 AM: Document has changed
9/26/2018 9:13:30 AM: Document has changed
9/26/2018 9:23:30 AM: Document has changed
9/26/2018 9:33:30 AM: Document has changed
9/26/2018 9:39:45 AM: Document has changed // Document actually updated
9/26/2018 9:40:00 AM: Document has changed // Document actually updated
9/26/2018 9:43:30 AM: Document has changed
// Document updated many times for the next 30 minutes
// No more updates received 

As you can see, after precisely 1 hour, updates are no longer received. It is important to point that I am authenticated with an user account, not a service account. I haven't tested this behavior using a service account.

It is interesting how FirestoreChangeListener receives an update every 10 minutes even when the document was not changed. That is probably because Firestore resets the stream every 10 minutes. I am wondering if these extra updates are billed.

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the Firestore API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions