【发布时间】:2022-11-09 12:15:36
【问题描述】:
I have an node application running in Kubernetes scheduled a job in node scheduler to run every day by midnight, but scheduler is running twice a day.
Kubernetes
Version - 1.21.5
Node - 13.0
Server
I have two nodes with an load balancer.
Update1
var scheduler = require('node-schedule');
function getRule() {
var rule = new scheduler.RecurrenceRule();
// rule.minute = new scheduler.Range(0, 59, 59);
rule.hour = 23;
rule.minute = 45;
return rule;
}
exports.createSchedule = function () {
var rule = getRule();
scheduler.scheduleJob(rule, send1DayActivationReminderEmail);
};
This same set of code works in Heroku application, which runs only once.
-
could you please share some config or your job and cronjob that you are using ?
-
@HarshManvar Updated with config
-
how you are running this code in k8s could you please yaml config of job ?
-
I am running scheduler via node application, while starting node application, the above scheduler schedules the job.
标签: node.js kubernetes digital-ocean scheduler