问题
Each time I'm making a request using the Firestore library, there are 3 API calls made. One of them is taking to 60 seconds every time. I receive the data after some milliseconds, but in the network tab, I see a pending call that seems to be doing nothing.
Here's my code
import "firebase/firestore";
import firebase from "firebase/app";
const getData = () => {
firebase
.firestore()
.collection("myCollection")
.get();
}
Each time I call getData(), 3 API calls are made. Here's the network tab:
The request URL of the second call is:
https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel?database=projects/my-project/databases/(default)
How can I avoid the 60s call?
回答1:
To avoid the 60s calls, I ended up calling the REST API directly without using the client library. Here's the documentation to follow to be able to make a request: Use the Cloud Firestore REST API and Cloud Firestore API
来源:https://stackoverflow.com/questions/55227974/firestore-always-make-3-api-calls-with-one-taking-60-secondes