Firestore 截止日期已超过节点 [英] Firestore Deadline Exceeded Node

查看:31
本文介绍了Firestore 截止日期已超过节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加载大约 30k 条记录的集合.即通过加载它.

I would like to load collection that is ~30k records. I.e load it via.

const db = admin.firestore();
let documentsArray: Array<{}> = [];
db.collection(collection)
  .get()
  .then(snap => {
    snap.forEach(doc => {
      documentsArray.push(doc);
    });
  })
  .catch(err => console.log(err));

这将始终抛出 Deadline Exceeded 错误.我已经寻找了某种机制,可以让我通过它进行分页,但我发现无法一次性查询到那么大的数量是令人难以置信的.

This will always throw Deadline Exceeded error. I have searched for some sorts of mechanism that will allow me to paginate trough it but I find it unbelievable not to be able to query for not that big amount in one go.

我在想可能是因为我的机器相当慢,我达到了限制,但后来我部署了简单的 express 应用程序,它可以对应用程序引擎进行提取,但仍然没有运气.

I was thinking that it may be that due to my rather slow machine I was hitting the limit but then I deployed simple express app that would do the fetching to app engine and still had no luck.

或者,我也可以使用 gcloud beta firestore export 导出集合,但它不提供 JSON 数据.

Alternatively I could also export the collection with gcloud beta firestore export but it does not provide JSON data.

推荐答案

最后的问题是,处理来自 Firestore 的 30k 记录的机器不够强大,无法及时获取所需的数据.通过使用 GCE 和 n1-standard-4 GCE 解决.

In the end the issue was that machine that was processing the 30k records from the Firestore was not powerful enough to get the data needed in time. Solved by using, GCE with n1-standard-4 GCE.

这篇关于Firestore 截止日期已超过节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆