【问题标题】:Firestore runTransaction in Cloud Functions takes about 5 seconds on it's first callCloud Functions 中的 Firestore runTransaction 第一次调用大约需要 5 秒
【发布时间】:2021-10-14 00:44:54
【问题描述】:

部署 Cloud Function 后,运行 Firestore 事务始终需要大约 5 秒。在调用 runTransaction 和在给定的事务函数中被调用之间会浪费时间。

事务中是否发生任何事情都没有关系。

运行 Cloud Function 两次后,5 秒延迟消失。

有什么解决办法吗?

【问题讨论】:

    标签: firebase google-cloud-firestore google-cloud-functions


    【解决方案1】:

    这段时间很可能用于加载 SDK,并建立与服务器的第一个路由/连接。我怀疑您可以在代码中对此做些什么。

    可以考虑使用 Firestore Lite SDK,它更小,因此加载速度更快。它不支持本地磁盘缓存或实时监听器,但在 Cloud Functions 中,这些不太重要。

    【讨论】:

      猜你喜欢
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-31
      • 1970-01-01
      • 2018-03-31
      • 2021-02-11
      • 2019-02-12
      相关资源
      最近更新 更多