Vadim Sheremetov
Vadim Sheremetov

Reputation: 590

How to schedule an update/notification using firebase cloud functions with dynamic frequency?

I have an app, where I have an admin and a customer. Admins can invite users that are in a line. Admins can configure maximum waiting time for which a customer should show up after he gets invited. If he does not show up in specified period of time I need to update the database to set the status of a customer's ticket to "no-appearance" and send notification to a customer.

How can I do that using firebase cloud functions? It looks like I cannot setTimeout because functions are limited to 540 seconds and it is not applicable in my case. Looks like Pub-sub functions can only be created with a specific period which you have to determine statically

Upvotes: 0

Views: 150

Answers (1)

Chris Chávez
Chris Chávez

Reputation: 431

You can use Google Cloud Task to send a scheduled job to trigger cloud functions. Here an article about that: https://medium.com/swlh/event-driven-scheduled-jobs-using-gcp-cloud-tasks-e712c760ab95

The difference of a Pub/Sub is that you can send a task with a dynamic schedule and that task runs only once.

Upvotes: 2

Related Questions