我正在从’node-schedule’模块运行作业. 在localhost上一切都很好但是当我在Heroku上传到生产时却没有. 我在设置中更改了我的时区 – var config to TZ at Asia / Jerusalem 但它仍然无效. 知道为什么
在localhost上一切都很好但是当我在Heroku上传到生产时却没有.
我在设置中更改了我的时区 – > var config to TZ at Asia / Jerusalem
但它仍然无效.
知道为什么吗?上传我的代码虽然我认为它是Heroku的东西,而不是代码.目前正在更新每分钟只是为了测试它,有用的是它每1.5小时一次
const schedule = require("node-schedule");
const needle = require("needle");
let j = schedule.scheduleJob("* /1 * * * *", function() {
needle.put("https://myserver.herokuapp.com/myendpoint");
});
我使用以下代码在Heroku和Azure上成功使用cron作业.我正在使用
cron
import { CronJob } from 'cron';
const doSomething = new CronJob(
'0 0 * * 1', //cron time
fnname, //replace with your function that you want to call
null, //oncomplete
false, //start flag
'America/Los_Angeles',// timezone
);
doSomething.start()
