I have 2 use cases for scheduled functions for my application. One which runs once a day and deletes users that have been inactive for x amount of months. This deletes the user from firebase auth and I have an event-driven function that deletes the user data when that happens. Secondly, I have a use case for which I need to read through all the documents in a potentially large collection and perform some arithmetic with the data and then store it in a bunch of different collections. This will also run once a day and the data will be collected each day to show the user the change over time. To my understanding, scheduled functions have at most 9 minutes to execute so am I wondering if that time frame will suffice, or will I have to look elsewhere like cloud run?
Sorry if this is an obvious question I am quite new to this.
CodePudding user response:
It totally depends on the amount of documents you are trying to process and I would recommend running some tests with an estimated number of documents you might have to process. You can checkout Cloud Functions Gen 2 that can run HTTP functions for up to 60 minutes and can have up to 16GB of RAM and 4 vCPUs. Cloud Scheduler might be useful to trigger the HTTP function periodically.