<commit_before>/*
*
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/

var lfs = require("lfs");
var fs = require("fs");
var serviceManager = require("lservicemanager");
var url = require("url");
var http = require("http");
var request = require("request");
var lconfig = require('lconfig');

SCHEDULE_ACTION_DIRECT = 0; // Live direct callbacks, not savable
SCHEDULE_ACTION_URI = 1; // Indirect service URIs, savable

exports.Scheduler = function() {
    this.scheduledActions = [];
    this.filename = "scheduler.json";
};

exports.Scheduler.prototype.loadAndStart = function() {
    var self = this;
    lfs.readObjectsFromFile(this.filename, function(objects) {
        objects.forEach(function(action) {
            if (serviceManager.isInstalled(action.serviceId)) return;
            self.scheduleURL(new Date(action.at), action.serviceId, action.url);
        });
    });
}

exports.Scheduler.prototype.savePending = function() {
    var stream = fs.createWriteStream(this.filename, {'flags':'w', 'encoding': 'utf-8'});
    for(var i = 0; i < this.scheduledActions.length; ++i) {<commit_msg>Fix for the scheduler so that it will just attempt to start all pending actions.<commit_after>/*
*
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/

var lfs = require("lfs");
var fs = require("fs");
var serviceManager = require("lservicemanager");
var url = require("url");
var http = require("http");
var request = require("request");
var lconfig = require('lconfig');

SCHEDULE_ACTION_DIRECT = 0; // Live direct callbacks, not savable
SCHEDULE_ACTION_URI = 1; // Indirect service URIs, savable

exports.Scheduler = function() {
    this.scheduledActions = [];
    this.filename = "scheduler.json";
};

exports.Scheduler.prototype.loadAndStart = function() {
    var self = this;
    lfs.readObjectsFromFile(this.filename, function(objects) {
        objects.forEach(function(action) {
            self.scheduleURL(new Date(action.at), action.serviceId, action.url);
        });
    });
}

exports.Scheduler.prototype.savePending = function() {
    var stream = fs.createWriteStream(this.filename, {'flags':'w', 'encoding': 'utf-8'});
    for(var i = 0; i < this.scheduledActions.length; ++i) {
{'fraction_non_alphanumeric': 0.1452370781717215, 'fraction_numerical': 0.006834686031610423, 'mean_word_length': 4.147252747252748, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4768300', 'n_tokens_mistral': 726, 'n_tokens_neox': 713, 'n_words': 183}