[英]Firestore set fails on first try but works on second
I have a simple firestore set operation like so 我有一个像这样的简单的firestore设置操作
var docRef = firebase.firestore().collection('sessions').doc(this.state.userID);
docRef.set({
Name: seshName,
Type: theType,
}).then(()=> {
resolve(true);
});
but for some reason, it always fails on the first try after app install, but then subsequent attempts are fast and smooth. 但由于某种原因,在安装应用后首次尝试总是会失败,但是随后的尝试又快速又流畅。
Anyone encounter similar experiences? 有人遇到过类似的经历吗? Any clues? 有什么线索吗?
Thanks for trying to help. 感谢您的帮助。 I found the cause. 我找到了原因。 Adding .catch does not help as it just hangs as usual without any output. 添加.catch并没有帮助,因为它像往常一样挂起而没有任何输出。
It seems that Firestore only allows 1 connection at a time? 看来Firestore一次只允许1个连接? This issue only happens if I do a DB action right before this .set operation, it seems that the previous DB action isn't complete yet. 仅当我在此.set操作之前立即执行数据库操作时,才会出现此问题,似乎先前的数据库操作尚未完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.