Commit babeb4cf authored by 陈志良's avatar 陈志良

增加耗时Log

parent 88744e39
......@@ -581,7 +581,7 @@ router.get('/thread/:tid/get', function(req, res, next) {
threads.push(thread);
var firstLoadLevelBegin = new Date();
util.loadLevel(req.session.user.ent_code, threads, function() {
console.log("firstLoadLevelTime:"+Math.abs(new Date() - firstLoadLevelBegin));
console.log("获取帖子相关用户的经验(一个OpenId拿一次)总耗时:"+Math.abs(new Date() - firstLoadLevelBegin));
if (threads && threads.length > 0) {
thread = threads[0];
}
......
......@@ -311,6 +311,7 @@ exports.getThreadById = function(tid, callback) {
if (doc) {
async.parallel([
function(cb) {
var getAllCommentBegin = new Date();
if (doc.type !== 1) {
cb(null, null);
return;
......@@ -321,6 +322,7 @@ exports.getThreadById = function(tid, callback) {
};
//获取最新10条评论
forumCommentService.getAllComment(conditions, 1, 10, function(err, results) {
console.log("获取最新10条评论耗时:" + Math.abs(new Date()-getAllCommentBegin));
if (err) {
console.log(err);
cb(err, null);
......@@ -404,6 +406,7 @@ exports.getThreadById = function(tid, callback) {
// });
// },
function(cb) {
var canyuPeopleCountBegin = new Date();
//获取发帖人数
var key = 'pisns-forum-thread:' + tid + ':amount';
redis.get(key,function(err,value){
......@@ -433,6 +436,7 @@ exports.getThreadById = function(tid, callback) {
}
});
}
console.log("获取发帖人数耗时:" + Math.abs(new Date()-begin));
});
// ForumThread.aggregate({
......@@ -473,7 +477,7 @@ exports.getThreadById = function(tid, callback) {
// threadObj.latestPhotos = latestPhotos;
// threadObj.hotPhotos = hotPhotos;
threadObj.canyuPeopleCount = canyuPeopleCount;
console.log("getThreadByIdTime:" + Math.abs(new Date()-end));
console.log("获取帖子内容总耗时:" + Math.abs(new Date()-begin));
callback(null, threadObj);
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment