Currently working on a project where i will be using firebase to save data i get from an external api. I am wondering if it is possible to do this on an interval (like say every 2 days) and then save this data to a firestore database.
CodePudding user response:
Firebase functions, or Google Cloud Functions, run in response to events. Cloud functions are not intended to run indefinitely. So, while it may be possible technically to force the Cloud Function to stay alive, that is not the intended use. Therefore the answer is no.
You would use a persistent resource that never scales to zero (or off), e.g. a process that is designed to never turn off.
CodePudding user response:
Note that your question may be considered as too vague for Stack Overflow.
Answer: Yes, you can use a scheduled Cloud Function that runs every two days and that calls the API (for example via axios) and saves the result to a Firebase database (RTDB or Firestore).