mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-02-17 19:59:12 -06:00
Updated the startTimer function to use cron in the timer task
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
const pauseController = require('../controller/pause');
|
||||
const schedule = require('node-schedule');
|
||||
const {isValidCron} = require("cron-validator");
|
||||
|
||||
let job;
|
||||
|
||||
module.exports.startTimer = (timeLevel) => {
|
||||
job = schedule.scheduleJob(getRuleFromLevel(timeLevel), () => this.runTask());
|
||||
module.exports.startTimer = (cron) => {
|
||||
if (!isValidCron(cron)) return;
|
||||
job = schedule.scheduleJob(cron, () => this.runTask());
|
||||
}
|
||||
|
||||
module.exports.runTask = async () => {
|
||||
|
||||
Reference in New Issue
Block a user