侦听器的Firebase Firestore成本 [英] Firebase Firestore cost with listener

查看:50
本文介绍了侦听器的Firebase Firestore成本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有几个与消防站费用有关的问题,但我找不到一个能使我头脑清醒的问题.

There are several questions related to firestore cost, but I couldn't find the one which clarify the question in my head.

我有两种情况,我想知道每种情况下的估计费用,文档读取数.

I have two cases, and I'd like to know the estimated cost, the document read count, in each case.

让我们假设我有一个显示10个用户的单页应用程序.打开应用程序会将侦听器附加到userList集合,并侦听该集合中的10个文档,然后关闭应用程序将侦听器与firestore分离.

情况1:如果没有任何文档的更新,我将打开并关闭该应用程序,然后在30分钟之内再次打开它.文档读取计数是多少?10、20或其他?

Case 1: If there is no update on any document, I open and close the app, and open it again within 30 minutes. What the document read count would be? 10, 20, or any other?

情况2:我打开和关闭应用程序;一个文档已更新,我在30分钟之内再次将其打开.文档读取计数是多少?11、21或其他?

Case 2: I open and close the app; one document is updated, and I open it again within 30 minutes. What the document read count would be? 11, 21, or any other?

推荐答案

这取决于您关闭应用程序"的意思.

It depends on what you mean by "close the app".

如果您的侦听器由于网络连接中断而被切断,但是应用程序进程仍在运行,则当网络恢复正常时,该侦听器将自动重新连接.如果网络在30分钟内恢复正常,则不收取更新费用.如果网络在30分钟后恢复正常,则您需要为新查询付费.

If you have a listener that gets cut off due to loss of network connectivity, but the app process is still running, the listener will automatically reattach when the network comes back. If the network comes back within 30 minutes, you are not charged for updates. If the network comes back after 30 minutes, you are charged for new query.

如果您有一个监听器被切断,因为应用程序进程已被操作系统终止,随后又重新启动了该应用程序,则该应用程序进程被终止,您将需要为另一个查询付费.

If you have a listener that gets cut off because the app process was terminated by the OS, and later gets reattached when the app is launched again, you will be charged for another query.

如果应用仅在后台运行但未终止,并且侦听器仍在后台运行,则行为没有任何变化,但是您仍需为仍在添加文档的时间内(但在应用执行之前)支付文档更新的费用.最终失去网络并完全终止.

If the app is simply backgrounded but not terminated, and the listener is still active in the background, there are no changes in behavior, but you are still paying for document updates during the time it is still added but before the app process eventually loses network and is terminated completely.

如果您的代码删除了一个侦听器并再次添加它,则将向您收取新查询的费用.

If your code removes a listener and adds it again, you will be charged for a new query.

您将必须弄清楚哪种情况适用.SDK不会跟踪用户的意图.它仅跟踪网络的行为,并受操作系统管理的进程状态的影响.用户关闭应用程序"的动作是在用户界面上进行的.可能涉及许多细节,这些细节并不是立即显而易见的.

You will have to figure out which of these situations apply. The SDK doesn't track the user's intent. It just tracks the behavior of the network, and is affected by the state of the process, as managed by the OS. The user's action of "closing an app" could involve any number of details which are not immediately obvious.

这篇关于侦听器的Firebase Firestore成本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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