function startRecurrentTask (taskName, task, interval) {
        if (typeof task !== 'function') throw new Error('task should be a function')
        if (typeof interval !== 'number') throw new Error('interval should be a integer')

        if (!(taskName in recurrentTasks)) {
            recurrentTasks[taskName] = {
                task_name: taskName,
                task,
                interval,
                enabled: false,
                running: false,
                timer_id: null,
                failures: 0,
                run_attempts: 0,
                run_times: 0
            }
        }
        let recurrentTask = recurrentTasks[taskName]
        if (recurrentTask.enabled) {
            if (recurrentTask.timer_id) {
                clearInterval(recurrentTask.timer_id)
                recurrentTask.timer_id = null
            }
            if (recurrentTask.running) {
                log.info('Abandoning running of task type' + taskName)
                recurrentTask.running = false
            }
        }
        recurrentTask.enabled = true
        recurrentTask.interval = interval
        recurrentTask.timer_id = setInterval(() => {
            runRecurrentTask(recurrentTask)
        }, interval)
    }
/**
     * Starts running a named task at the specified interval
     *
     * @param taskName The name of the task
     * @param task Function to be run at the specified interval
     * @param interval Number of ms between task runs
     */
Starts running a named task at the specified interval
@param taskName The name of the task
@param task Function to be run at the specified interval
@param interval Number of ms between task runs
Starts running a named task at the specified interval @param taskName The name of the task @param task Function to be run at the specified interval @param interval Number of ms between task runs
function startRecurrentTask (taskName, task, interval) {
        if (typeof task !== 'function') throw new Error('task should be a function')
        if (typeof interval !== 'number') throw new Error('interval should be a integer')
        if (!(taskName in recurrentTasks)) {
            recurrentTasks[taskName] = {
                task_name: taskName,
                task,
                interval,
                enabled: false,
                running: false,
                timer_id: null,
                failures: 0,
                run_attempts: 0,
                run_times: 0
            }
        }
        let recurrentTask = recurrentTasks[taskName]
        if (recurrentTask.enabled) {
            if (recurrentTask.timer_id) {
                clearInterval(recurrentTask.timer_id)
                recurrentTask.timer_id = null
            }
            if (recurrentTask.running) {
                log.info('Abandoning running of task type' + taskName)
                recurrentTask.running = false
            }
        }
        recurrentTask.enabled = true
        recurrentTask.interval = interval
        recurrentTask.timer_id = setInterval(() => {
            runRecurrentTask(recurrentTask)
        }, interval)
    }
function startRecurrentTask ( taskName , task , interval ) { if ( typeof task !== 'function' ) throw new Error ( 'task should be a function' ) if ( typeof interval !== 'number' ) throw new Error ( 'interval should be a integer' ) if ( ! ( taskName in recurrentTasks ) ) { recurrentTasks [ taskName ] = { task_name : taskName , task , interval , enabled : false , running : false , timer_id : null , failures : 0 , run_attempts : 0 , run_times : 0 } } let recurrentTask = recurrentTasks [ taskName ] if ( recurrentTask . enabled ) { if ( recurrentTask . timer_id ) { clearInterval ( recurrentTask . timer_id ) recurrentTask . timer_id = null } if ( recurrentTask . running ) { log . info ( 'Abandoning running of task type' + taskName ) recurrentTask . running = false } } recurrentTask . enabled = true recurrentTask . interval = interval recurrentTask . timer_id = setInterval ( ( ) => { runRecurrentTask ( recurrentTask ) } , interval ) }
Starts running a named task at the specified interval
 @param taskName The name of the task
 @param task Function to be run at the specified interval
 @param interval Number of ms between task runs
Starts running a named task at the specified interval @param taskName The name of the task @param task Function to be run at the specified interval @param interval Number of ms between task runs