How to create cron jobs dynamically in firebase [duplicate]

徘徊边缘 提交于 2020-06-17 13:13:05

问题


Does anyone know how can I set up Cron Jobs dynamically with Firebase? I want to build a rule engine using which the Client can specify the rules, actions, and schedule and based on that I need to schedule that particular rule. Since the scheduling is in the hand of the Client. I can set a predefined frequency for the JOB.

I know in Node.js I can do it with libraries like "node-schedule". But since the Client strictly wants to use Firebase and Angular. I can't use that solution


回答1:


There is no way to dynamically create schedule functions with just Cloud Functions.

The two most common approaches are:

  • Have a regularly scheduled Cloud Function (say every minute) that then reads the tasks from a database, and executes the tasks that are up.
  • Use a separate scheduler service that has an API to create schedules, like Cloud Tasks. Doug wrote a great article about that in How to schedule a Cloud Function to run in the future with Cloud Tasks (to build a Firestore document TTL).

Also see:

  • How to create cron jobs in firebase programmatically


来源:https://stackoverflow.com/questions/60439049/how-to-create-cron-jobs-dynamically-in-firebase

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