pico-engine-core
Advanced tools
Comparing version 0.29.3 to 0.29.4
{ | ||
"name": "pico-engine-core", | ||
"version": "0.29.3", | ||
"version": "0.29.4", | ||
"description": "The core javascript api for the pico-engine. (no http, logging, process management etc...)", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -288,2 +288,6 @@ var _ = require("lodash"); | ||
}catch(err){ | ||
if(!_.isFunction(callback)){ | ||
emitter.emit("error", {}, err); | ||
return; | ||
} | ||
return callback(err); | ||
@@ -290,0 +294,0 @@ } |
var _ = require("lodash"); | ||
var lt = require("long-timeout");//makes it possible to have a timeout longer than 24.8 days (2^31-1 milliseconds) | ||
var cuid = require("cuid"); | ||
var schedule = require("node-schedule"); | ||
@@ -9,2 +10,3 @@ | ||
var cron_by_id = {}; | ||
var most_recent_update_id; | ||
@@ -15,3 +17,9 @@ /** | ||
var update = function update(){ | ||
var my_update_id = cuid(); | ||
most_recent_update_id = my_update_id; | ||
conf.db.nextScheduleEventAt(function(err, next){ | ||
if(most_recent_update_id !== my_update_id){ | ||
//schedule is out of date | ||
return; | ||
} | ||
if(curr_timeout){ | ||
@@ -18,0 +26,0 @@ //always clear the timeout since we're about to re-schedule it |
@@ -11,1 +11,2 @@ require("./extractRulesetID.test"); | ||
require("./cleanEvent.test"); | ||
require("./Scheduler.test"); |
206254
44
5631