gpt4 book ai didi

firebase - 甚至没有运行应用程序,Firestore 数据库读取就在增加

转载 作者:行者123 更新时间:2023-12-04 15:42:07 26 4
gpt4 key购买 nike

我注意到 Firestore 中的读取量有所增加。我正在本地主机上测试我的应用程序。

今天我决定仔细看看阅读量,从零开始。我等了大约 3 分钟,甚至没有运行我的应用程序或执行任何读取操作,我的读取次数上升到 210 次,写入次数增加了 2 次。现在这一定很奇怪,因为我知道应用程序甚至没有运行,而且在我开始时它全部为零。

我尽量避免使用 onvalueChanges() 和 snapshotChanges(),因为它们会产生大量读取。

下面是我在首页调用的服务。

有人对正在发生的事情有想法并愿意分享吗?

提前致谢。

 export class CatService {
lastVisibleCat: any;
cats = [];
fecha = new Date().setHours(23, 59, 5, 9);
todaysDate = new Date(this.fecha);


constructor(public afs: AngularFirestore) {
}

getCats() {
const reference = this.afs.collection('Cats');
const query1 = reference.ref.where('timeStampEndDate', '>=',
this.todaysDate);
return query1.get().then(snapShot => {
snapShot.forEach(cat => {
this.cats.push({ ...cat.data(), id: cat.id });
});
return this.cats;
});
}

}

最佳答案

这里可能有几件事在起作用:

  • 读取计数不是实时的,因此数据可能会延迟
  • Firebase 控制台中的读取也计入读取次数方面的计费操作

关于firebase - 甚至没有运行应用程序,Firestore 数据库读取就在增加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57491246/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com