Skip to content

Commit

Permalink
capture start time only on successful completion
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jun 12, 2015
1 parent 37cf071 commit 96540e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/helpers/createExtensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ function Storage(fn){
this.fn = fn;
this.uid = uid++;
this.name = meta.name;
this.captureTime = Date.now();
this.startHr = [];
}

Storage.prototype.capture = function(){
captureLastRun(this.fn);
captureLastRun(this.fn, this.captureTime);
};

Storage.prototype.release = function(){
Expand All @@ -31,7 +32,6 @@ function createExtensions(ee){
},
before: function(storage){
storage.startHr = process.hrtime();
storage.capture();
ee.emit('start', {
uid: storage.uid,
name: storage.name,
Expand All @@ -42,6 +42,7 @@ function createExtensions(ee){
if(result && result.state === 'error'){
return this.error(result.value, storage);
}
storage.capture();
ee.emit('stop', {
uid: storage.uid,
name: storage.name,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dependencies": {
"bach": "^0.4.1",
"es6-weak-map": "^1.0.1",
"last-run": "^1.0.0",
"last-run": "^1.1.0",
"lodash": "^3.5.0",
"undertaker-registry": "0.0.2"
},
Expand All @@ -36,8 +36,8 @@
"once": "^1.3.1",
"promised-del": "^1.0.2",
"through2": "^0.6.3",
"undertaker-common-tasks": "git://github.com/phated/undertaker-common-tasks",
"undertaker-task-metadata": "git://github.com/undertakerjs/undertaker-task-metadata",
"undertaker-common-tasks": "git://github.com/phated/undertaker-common-tasks#3d3a89ce66cf7397bb00ea9924e12e07db3bf987",
"undertaker-task-metadata": "git://github.com/undertakerjs/undertaker-task-metadata#eb02af6139fcf51a8abb5b7b76a993744512d69d",
"vinyl-fs": "^1.0.0"
},
"keywords": [
Expand Down

0 comments on commit 96540e3

Please sign in to comment.