<commit_before>var fs = require('fs');
var events = require('events');
var util = require('util');
var later = require('later');
later.date.localTime();

/**
 * Scheduler task
 * @param config
 * @param timer frequency (seconds)
 * @constructor
 */
function Scheduler(config) {
    var self = this;

    /** upcoming later tasks */
    this.tasks = [];

    /**
     * c-tor
     */
    this.init = function() {};

    /**
     * run scheduler
     */
    this.run = function() {
        for (var c in config.schedule ) {
            var sched = later.parse.text(config.schedule[c]);
            config.log('Schedule', 'Next run of '  + c + ' scheduled for ' + later.schedule(sched).next(1), { date: new Date(), level: "verbose" });
            this.tasks.push({ task: c, schedule: sched, timer: later.setTimeout(function() {
                self.emit(this.RUN_TASK, task);
            }, sched)});
        }
    };

    /**
     * clear scheduled tasks
     */
    this.clearTasks = function() {
        for (var c in this.tasks) {
            clearTimeout(this.tasks[c].timer);
        }
        this.tasks = [];

    };

    this.init();<commit_msg>Update Scheduler.js<commit_after>var fs = require('fs');
var events = require('events');
var util = require('util');
var later = require('later');
later.date.localTime();

/**
 * Scheduler task
 * @param config
 * @param timer frequency (seconds)
 * @constructor
 */
function Scheduler(config) {
    var self = this;

    /** upcoming later tasks */
    this.tasks = [];

    /**
     * c-tor
     */
    this.init = function() {};

    /**
     * run scheduler
     */
    this.run = function() {
        for (var c in config.schedule ) {
            var sched = later.parse.text(config.schedule[c]);
            config.log('Schedule', 'Next run of '  + c + ' scheduled for ' + later.schedule(sched).next(1), { date: new Date(), level: "verbose" });
            this.tasks.push({ task: c, schedule: sched, timer: later.setTimeout(function() {
                self.emit(this.RUN_TASK, c);
            }, sched)});
        }
    };

    /**
     * clear scheduled tasks
     */
    this.clearTasks = function() {
        for (var c in this.tasks) {
            clearTimeout(this.tasks[c].timer);
        }
        this.tasks = [];

    };

    this.init();
{'fraction_non_alphanumeric': 0.1668833983528392, 'fraction_numerical': 0.0008669267446900737, 'mean_word_length': 2.081441922563418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4521809', 'n_tokens_mistral': 699, 'n_tokens_neox': 680, 'n_words': 164}