Permalink
Browse files

More specific ijod timings

  • Loading branch information...
temas committed Mar 19, 2013
1 parent 74b5093 commit 1fe8ded0a970ac01b2c9f4ff9b2248250934ef2f
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/ijod.js
View
@@ -402,7 +402,7 @@ IJOD.prototype.startAddTransaction = function() {
*/
};
-IJOD.prototype.commitAddTransaction = function(cbDone) {
+IJOD.prototype.commitAddTransaction = function(timings, cbDone) {
if (!this.transactionItems || this.transactionItems.length === 0) {
return cbDone();
}
@@ -421,6 +421,7 @@ IJOD.prototype.commitAddTransaction = function(cbDone) {
}, function(err) {
var startTime = Date.now();
backend.put(self.path, writeBuffer, function (err) {
+ timings["commit-backend"] = Date.now() - startTime;
writeBuffer = null;
if (!err) {
logger.debug("Saving %d entries to ijod", self.transactionQueries.length);
@@ -434,6 +435,7 @@ IJOD.prototype.commitAddTransaction = function(cbDone) {
allBinds = allBinds.concat(query.binds);
});
dbMod(id, allSql, allBinds, function(err){
+ timings["commit-db"] = Date.now() - startTime;
if(err) logger.warn("err bulk writing",err);
instruments.timing({
"ijod.save_time": (Date.now() - startTime)
@@ -823,7 +825,7 @@ exports.batchSmartAdd = function(entries, callback) {
}
start = Date.now();
- ij.commitAddTransaction(function(error) {
+ ij.commitAddTransaction(timings, function(error) {
timings.commit = Date.now() - start;
callback(error, timings);
});

0 comments on commit 1fe8ded

Please sign in to comment.