0

I want to run a function after a specific amount of delay. For example, when some event happens I want to send a push notification to a user exactly 1 hour later. So a I need a function that should run exactly one hour later after this event happened. How can I do that? I know we can schedule a function with cron etc. but this runs the function on a specific time each day or each hour but couldn't find anything about how to run a function after specific amount of time when triggered.

Akil Demir
  • 150
  • 1
  • 11
  • There is no built-in trigger type like that, although I often need it. My typical approach is to set up a periodic trigger, that then reads a queue of tasks. It's not exactly the one hour interval that you describe, but works pretty well for many use-cases. Alternatively you can use Cloud Scheduler to schedule the delayed activity. See https://stackoverflow.com/questions/56074188/how-to-create-cron-jobs-in-firebase-programmatically – Frank van Puffelen Aug 10 '19 at 18:32
  • 1
    You can use Cloud Tasks to schedule a function invocation on some delay. – Doug Stevenson Aug 10 '19 at 19:03

0 Answers0