added timing to prune

v1.18.x
Baris Soner Usakli 11 years ago
parent 11b0f44ae9
commit daa1154797

@ -57,7 +57,7 @@ var fs = require('fs'),
return; return;
} }
var msg = '[' + new Date().toUTCString() + '] - ' + username + '(uid ' + uid + ') ' + string + '\n'; var msg = '[' + new Date().toUTCString() + '] - ' + username + '(uid ' + uid + ') ' + string;
log(msg); log(msg);
}); });
} }
@ -65,7 +65,7 @@ var fs = require('fs'),
events.log = function(msg) { events.log = function(msg) {
var logFile = path.join(nconf.get('base_dir'), logFileName); var logFile = path.join(nconf.get('base_dir'), logFileName);
fs.appendFile(logFile, msg, function(err) { fs.appendFile(logFile, msg + '\n', function(err) {
if(err) { if(err) {
winston.error('Error logging event. ' + err.message); winston.error('Error logging event. ' + err.message);
return; return;

@ -197,6 +197,8 @@ var async = require('async'),
}; };
Notifications.prune = function(cutoff) { Notifications.prune = function(cutoff) {
var start = process.hrtime();
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
winston.info('[notifications.prune] Removing expired notifications from the database.'); winston.info('[notifications.prune] Removing expired notifications from the database.');
} }
@ -269,6 +271,9 @@ var async = require('async'),
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
winston.info('[notifications.prune] Notification pruning completed. ' + numPruned + ' expired notification' + (numPruned !== 1 ? 's' : '') + ' removed.'); winston.info('[notifications.prune] Notification pruning completed. ' + numPruned + ' expired notification' + (numPruned !== 1 ? 's' : '') + ' removed.');
} }
var diff = process.hrtime(start);
events.log('Pruning notifications took : ' + (diff[0] * 1e3 + diff[1] / 1e6) + ' ms');
}); });
}); });

Loading…
Cancel
Save