Delay Google Cloud Function

后端 未结 4 877
不思量自难忘°
不思量自难忘° 2021-01-23 07:34

I have a swift iPhone application paired with Google Firebase. Within the application the user will complete an action (press a button). At this point, I would like to schedule

相关标签:
4条回答
  • 2021-01-23 07:47

    Would a delayed Cloud Task work for you?

    You can create a Cloud Task that is delayed and calls your function through an HTTP trigger. The task can be then cancelled if your user performs the second action you desribe. There is a number of dedicated client libraries for Cloud Tasks, as well as a REST API.

    0 讨论(0)
  • 2021-01-23 08:06

    There is no built-in way to delay the trigger on a Cloud Function, or to re-trigger it after a certain delay. The best way I can think of using Cloud Functions is to set up a periodic trigger as shown here: Cloud Functions for Firebase trigger on time?. And then in that periodic trigger you determine what jobs have to run.

    0 讨论(0)
  • 2021-01-23 08:10

    I recently had a similar issue that was solved by using Cloud Scheduler and Firestore. I set up a job that would trigger a cloud function every 5 minutes that would check a Firestore collection. It would retrieve the data on when a cloud function should be triggered and trigger it. It also depends how accurate you want your time triggers to be. It's not optimal to have it trigger all the time for no reason but in my case it worked.

    0 讨论(0)
  • 2021-01-23 08:14

    You could use https://delayedrequest.com as long as you can invoke your Firebase Function via an http request.

    0 讨论(0)
提交回复
热议问题