Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
// Stop all timeouts
for (let i = 0; i < context.scripts[name].timeouts.length; i++) {
clearTimeout(context.scripts[name].timeouts[i]);
}
// Stop all intervals
for (let i = 0; i < context.scripts[name].intervals.length; i++) {
clearInterval(context.scripts[name].intervals[i]);
}
// Stop all scheduled jobs
for (let i = 0; i < context.scripts[name].schedules.length; i++) {
if (context.scripts[name].schedules[i]) {
const _name = context.scripts[name].schedules[i].name;
if (!nodeSchedule.cancelJob(context.scripts[name].schedules[i])) {
adapter.log.error('Error by canceling scheduled job "' + _name + '"');
}
}
}
// Stop all time wizards jobs
for (let i = 0; i < context.scripts[name].wizards.length; i++) {
if (context.scripts[name].wizards[i]) {
context.scheduler.remove(context.scripts[name].wizards[i]);
}
}
// if callback for on stop
if (typeof context.scripts[name].onStopCb === 'function') {
context.scripts[name].onStopTimeout = parseInt(context.scripts[name].onStopTimeout, 10) || 1000;
conn.query('select * from autofood', function(err,rows,fields){
let len = rows.length;
let tem = rows[len-1].type;
if (tem !== x) {
if (schedule.scheduledJobs['feed']) {
var result = schedule.cancelJob('feed');
console.log("关闭当前定时: ")
console.log(result)
}
big()
}else{
console.log("same")
}
})
}
const dispose = () => {
schedule.cancelJob('updateFeeds');
};
clearSchedule: function (schedule) {
if (context.scheduler.get(schedule)) {
sandbox.verbose && sandbox.log('clearSchedule() => wizard cleared', 'info');
const pos = script.wizards.indexOf(schedule);
if (pos !== -1) {
script.wizards.splice(pos, 1);
}
context.scheduler.remove(schedule);
} else {
for (let i = 0; i < script.schedules.length; i++) {
if (script.schedules[i] === schedule) {
if (!nodeSchedule.cancelJob(script.schedules[i])) {
adapter.log.error('Error by canceling scheduled job');
}
delete script.schedules[i];
script.schedules.splice(i, 1);
sandbox.verbose && sandbox.log('clearSchedule() => cleared', 'info');
return true;
}
}
}
sandbox.verbose && sandbox.log('clearSchedule() => invalid handler', 'warn');
return false;
},
setState: function (id, state, isAck, callback) {