Reputation: 63
As far as I know firebase charges your cloud functions based on cpu power functions consume per second, memory consumed by each function and also how many function calls you make in total. Now I need to do some checking inside my cloud function half a minute later after certain events happen. I am thinking of implementing the wait mechanism using settimeout function. But I'm afraid it may result in charging me a lot of money since I'm increasing program execution time by a lot and I'll be calling it frequently. So is it wise to call settimeout function inside firebase cloud? Will I be charged more because of taking more time to complete my function execution? Is there another way of doing this?
Upvotes: 1
Views: 850
Reputation: 317868
If you use setTimeout to delay the final result of your function, you will be billed for that time and the memory consumed during that time. There is currently no other way to schedule work on a delay.
Whether or not it's a good idea depends on your requirements. If you absolutely require that some followup action be checked in your function, then do what you have to do to make that happen, and be prepared to pay for it.
Upvotes: 2