Comparing version 0.0.12 to 0.0.13
@@ -110,4 +110,4 @@ "use strict"; | ||
schedule._nextRun = nextRun.toISOString(); | ||
schedule._lastUpdate = new Date().toISOString(); | ||
schedule._nextRun = nextRun; | ||
schedule._lastUpdate = new Date(); | ||
@@ -367,8 +367,2 @@ this._models.Dronos.findOneAndUpdate( | ||
var nextRun = getNextRun( schedule ); | ||
if ( !nextRun ) { | ||
nextRun = moment().add( 1000, 'years' ); | ||
} | ||
// mark the schedule as running if it is still due | ||
@@ -384,3 +378,3 @@ self._models | ||
_lastRun: moment().toISOString(), | ||
_nextRun: nextRun.toISOString() | ||
_nextRun: getNextRun( schedule ) | ||
} | ||
@@ -452,16 +446,10 @@ }, | ||
try { | ||
// run the handler in the context of the schedule object | ||
runner.call( schedule, { | ||
owner: schedule.owner, | ||
name: schedule.name, | ||
params: schedule.params | ||
}, function() { | ||
} ); | ||
// run the handler in the context of the schedule object | ||
runner.call( schedule, { | ||
owner: schedule.owner, | ||
name: schedule.name, | ||
params: schedule.params | ||
}, function() { | ||
done( true ); | ||
} catch ( e ) { | ||
done( false ); | ||
} | ||
} ); | ||
@@ -561,14 +549,14 @@ }; | ||
var s = later.parse.cron( schedule.recurrence ); | ||
var s = later.schedule( later.parse.cron( schedule.recurrence ) ); | ||
var args = [ 1 ]; | ||
if ( schedule.hasOwnProperty( 'start' ) ) { | ||
var now = moment(); | ||
if ( moment( schedule.start ).isAfter( now ) ) { | ||
args.push( schedule.start ); | ||
} | ||
var now = moment(); | ||
if ( schedule.hasOwnProperty( 'start' ) && moment( schedule.start ).isAfter( now ) ) { | ||
args.push( schedule.start ); | ||
} else { | ||
args.push( now.add( 1, 'second' ).toISOString() ); | ||
} | ||
s = later.schedule( s ); | ||
var nextRun = moment( s.next.apply( s, args ).toISOString() ); | ||
var nextRun = moment( s.next.apply( s, args ).toISOString() ).millisecond( 0 ).seconds( 0 ); | ||
@@ -579,3 +567,3 @@ if ( schedule.hasOwnProperty( 'end' ) && moment( schedule.end ).isBefore( nextRun ) ) { | ||
return nextRun.millisecond( 0 ).seconds( 0 ); | ||
return nextRun; | ||
} |
{ | ||
"name": "dronos", | ||
"description": "Dronos is a distributed scheduling system (with patterns similar to Linux's cron system), using MongoDB to coordinate running tasks (drons) across multiple nodes.", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"author": "Anthony Hildoer <anthony@bluerival.com>", | ||
@@ -6,0 +6,0 @@ "repository": { |
50532
1655