解析服务器-如何使用调度程序一遍又一遍地运行“作业" [英] Parse Server - How to use a scheduler to run 'jobs' over and over
本文介绍了解析服务器-如何使用调度程序一遍又一遍地运行“作业"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我花了整整一天的时间尝试使某种调度程序与我的Parse Server一起工作(在AWS Beanstalk Node.js上运行) 我能够在js文件中获取一些代码,但似乎无法正常工作. 有什么方法可以设置某种调度程序,这样我就不必通过仪表板手动运行作业了?
I have spent an entire day trying to get some kind of scheduler working with my Parse Server (running on AWS Beanstalk Node.js) I was able to get some code inside the js file but it did not seem like it was working. Is there any way I can set up some kind of scheduler so I don't have to manually run my jobs through the Dashboard?
推荐答案
You have Configure the nodejs cron job for parse-server job schedule.
1. install "CRON" module - npm install cron,(reference:https://www.npmjs.com/package/cron).
2. Change the parse server job Schedule function declaration.
Parse.Cloud.job("jobScheduleName", function(){ })
To
function jobScheduleName() { };
3.Run cron
var CronJob = require('cron').CronJob; //include dependency
//add this code to run job every 15 minute.
//set your time as per your run schedule.
new CronJob('0 */15 * * * *', function() {
Cron.jobScheduleName();
}, null, true,"timeZone");
这篇关于解析服务器-如何使用调度程序一遍又一遍地运行“作业"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文