Executing cloud functions after n seconds on demand

时光怂恿深爱的人放手 提交于 2020-06-17 13:09:07

问题


I am working on an application where I have to send notification to the users regarding some job, and user has to accept the job within 1 minute, if he doesn't, the job's request should be sent to the next user.

I am using firestore as a database. When I create a job, trigger will send notification to the assigned user. Now I have to wait for 60 seconds to confirm if user has accepted the job and started the procedure, if not I have to assign that job to the new user.

I am not sure how I can create such procedure where cloud functions are executed post delayed.

Example: First execution will be done by trigger, and it will order for second execution after 60 seconds. Second execution checks if job is accepted, if so it will terminate and demands no post delayed execution, if job is not accepted, it will repeat the procedure of first execution and request for third execution after 60 seconds.

What are the available resources in google cloud to achieve this?

Thanks


回答1:


You can use Cloud Tasks to schedule a delayed call back to a Cloud Function.



来源:https://stackoverflow.com/questions/56114875/executing-cloud-functions-after-n-seconds-on-demand

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!