mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 10:16:12 +01:00
added timing to prune
This commit is contained in:
@@ -57,7 +57,7 @@ var fs = require('fs'),
|
||||
return;
|
||||
}
|
||||
|
||||
var msg = '[' + new Date().toUTCString() + '] - ' + username + '(uid ' + uid + ') ' + string + '\n';
|
||||
var msg = '[' + new Date().toUTCString() + '] - ' + username + '(uid ' + uid + ') ' + string;
|
||||
log(msg);
|
||||
});
|
||||
}
|
||||
@@ -65,7 +65,7 @@ var fs = require('fs'),
|
||||
events.log = function(msg) {
|
||||
var logFile = path.join(nconf.get('base_dir'), logFileName);
|
||||
|
||||
fs.appendFile(logFile, msg, function(err) {
|
||||
fs.appendFile(logFile, msg + '\n', function(err) {
|
||||
if(err) {
|
||||
winston.error('Error logging event. ' + err.message);
|
||||
return;
|
||||
|
||||
@@ -197,6 +197,8 @@ var async = require('async'),
|
||||
};
|
||||
|
||||
Notifications.prune = function(cutoff) {
|
||||
var start = process.hrtime();
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
winston.info('[notifications.prune] Removing expired notifications from the database.');
|
||||
}
|
||||
@@ -269,6 +271,9 @@ var async = require('async'),
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
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');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user