0

I have a list of 10 time stamps which keeps on updating dynamically. In total there are 3 such lists for 3 users. I want to build a utility to trigger a function at the next upcoming time stamp. (preferably everything over server-less compute)

I am stuck in finding out how to achieve this over aws or firebase

U7786
  • 139
  • 1
  • 9

1 Answers1

2

On Firebase/Google Cloud Functions the two most common options are either to store the schedule in a database and then periodically trigger a Cloud Function and run the tasks that are due, or to use Cloud Tasks to dynamically schedule a callback to a separate Cloud Function for each task.

I recommend also reading:

Update (late 2022): there is now also a built-in way to schedule Cloud Functions dynamically: enqueue functions with Cloud Tasks.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Just for clarity's sake, does your first option refer to a polling based solution? Keep calling a cloud function, check if any tasks are present in firestore with a due time that has passed (or is about to pass), and execute them - otherwise return and check again in a few minutes? If this is correct, it seems like the most expensive (i.t.o. firebase pricing for function executions) of the two options, right? – Albert Hattingh Sep 26 '22 at 19:23
  • 1
    It depends on how often you execute the check, and I'd always recommend doing some back-of-napkin calculations on this overhead as Cloud Function invocations are really cheap. That said, the second option eliminates the polling altogether - so pick what you prefer. – Frank van Puffelen Sep 26 '22 at 20:17