Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firestore connection delays when enables WiFi in background #5783

Closed
shosokawa opened this issue Jun 10, 2020 · 1 comment · Fixed by #5857
Closed

Firestore connection delays when enables WiFi in background #5783

shosokawa opened this issue Jun 10, 2020 · 1 comment · Fixed by #5857

Comments

@shosokawa
Copy link

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 11.5 Build version 11E608c
  • Firebase SDK version: 6.25.0
  • Firebase Component: Firestore
  • Component version: 1.14.0
  • Installation method: CocoaPods

[REQUIRED] Step 2: Describe the problem

After changing a connection from 4G to WiFi in the background, it seems that it spent long time (about 20 seconds) to reconnect to the server at when the app has become active.
Some documents are created while the app is in the background, then makes the app active:

  • snapshotListener isn't called until about 20 seconds after
  • query.getDocuments with FirestoreSource.server is failed with the error:
Error Domain=FIRFirestoreErrorDomain Code=14 "Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to FirestoreSourceServer to retrieve the cached documents.)"

If it is called with FirestoreSource.default, it returns results from the cache.

Steps to reproduce:

  1. Activates an app with WiFi disabled. (4G is used)
  2. Makes the app background.
  3. Enables WiFi.
  4. Creates some documents on firestore in order to make snapshotListener called.
  5. Makes the app active
    -> After about 20 seconds, snapshotListener is called
@schmidt-sebastian
Copy link
Contributor

schmidt-sebastian commented Jun 11, 2020

@shosokawa Thanks for reporting this.

We have seen similar reports for Transactions (#4905) and believe that its fix (#4985) should apply to all of our networking logic.

It will take me a couple of days to look at this in more detail, which should allow us figure out why the code changes for #4905 don't apply in this case. Please do bear with us.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants