How to use the rescheduleJob function from node-schedule

Find comprehensive JavaScript node-schedule.rescheduleJob code examples handpicked from public code repositorys.

20
21
22
23
24
25
26
27
28
29
30
31
}


// 改变文章订阅任务的时间规则
const changeTimedTask = (name, cron, agent) => {
    if (!timedTaskIsExist(name, agent)) return createTimedTask(name, cron, agent)
    schedule.rescheduleJob(schedule.scheduledJobs[`${ name }`], cron)
    log(agent, `编辑文章订阅任务, id: ${ name }, Cron: ${ cron }`)
}


// 取消指定文章订阅任务
fork icon5
star icon25
watch icon0

37
38
39
40
41
42
43
44
45
46
        tomorrow.setUTCMinutes(tomorrow.getUTCMinutes() + 3);
        tomorrow.setDate(tomorrow.getDate() + 1);

        console.log(tomorrow)

        schedule.rescheduleJob(this.scheduleJob, { start: tomorrow, rule: scheduleConfig.getRule() });
        console.log(`Rescheduled puzzle system. Next occurance: ${this.scheduleJob.nextInvocation()})`)
    });
    console.log(`Started puzzle schedule. Next occurance: ${this.scheduleJob.nextInvocation()}`)
}
fork icon4
star icon6
watch icon0

+ 2 other calls in file

4
5
6
7
8
9
10
11
12
13
14
15
exports.schedule = function (config, callback) {
    jobs[config.name] = schedule.scheduleJob(config.cron, callback);
};


exports.reschedule = function (config) {
    jobs[config.name] = schedule.rescheduleJob(jobs[config.name], config.cron);
};


exports.nextInvocation = function (config) {
    if(jobs[config.name] !== undefined && jobs[config.name] !== null) {
fork icon2
star icon0
watch icon0

+ 3 other calls in file

23
24
25
26
27
28
29
30
31
32
33


exports.reschedulingJob = async (jobId, userData) => {
  try {
    var date = new Date(userData.date);
    logger.debug("RescheduleJob for JOB ID ..." + jobId);
    await schedule.rescheduleJob(jobId, date);
    return true;
  } catch (err) {
    logger.error("Error during rescheduling ", err);
    throw createError(500,"Internal Server Error")
fork icon1
star icon1
watch icon0

15
16
17
18
19
20
21
22
23
24
25
        users[message.user] = null;
        user = null;
    }
    if (!user) user = await registerNewUser(message, client, say);
    startMachine(user, say, { type: "message", content: message });
    // schedule.rescheduleJob("reminder_" + user.user, buildRecurrenceRule(user.reminder.rule))
}


exports.handleActionResponse = async (type, body, ack, say, client) => {
    let user = users[body.user.id];
fork icon0
star icon0
watch icon0

+ 2 other calls in file