Commit 88744e39 authored by 陈志良's avatar 陈志良

增加耗时Log

parent 9c67b999
...@@ -579,7 +579,9 @@ router.get('/thread/:tid/get', function(req, res, next) { ...@@ -579,7 +579,9 @@ router.get('/thread/:tid/get', function(req, res, next) {
} }
var threads = []; var threads = [];
threads.push(thread); threads.push(thread);
var firstLoadLevelBegin = new Date();
util.loadLevel(req.session.user.ent_code, threads, function() { util.loadLevel(req.session.user.ent_code, threads, function() {
console.log("firstLoadLevelTime:"+Math.abs(new Date() - firstLoadLevelBegin));
if (threads && threads.length > 0) { if (threads && threads.length > 0) {
thread = threads[0]; thread = threads[0];
} }
...@@ -605,6 +607,7 @@ router.get('/thread/:tid/get', function(req, res, next) { ...@@ -605,6 +607,7 @@ router.get('/thread/:tid/get', function(req, res, next) {
// rs.data = thread; // rs.data = thread;
// res.json(_.assign(rs, returnCode.SUCCESS)); // res.json(_.assign(rs, returnCode.SUCCESS));
} else { } else {
var redisPraiseLogBegin = new Date();
redisPraiseLog.get(ent_code, user.getMobileUser(req), 'thread', function(error, docs) { redisPraiseLog.get(ent_code, user.getMobileUser(req), 'thread', function(error, docs) {
if (thread.toObject) { if (thread.toObject) {
thread = thread.toObject(); thread = thread.toObject();
...@@ -616,6 +619,7 @@ router.get('/thread/:tid/get', function(req, res, next) { ...@@ -616,6 +619,7 @@ router.get('/thread/:tid/get', function(req, res, next) {
break; break;
} }
}; };
console.log("redisPraiseLogTime:"+Math.abs(new Date() - redisPraiseLogBegin));
var rs = {}; var rs = {};
rs.data = thread; rs.data = thread;
res.json(_.assign(rs, returnCode.SUCCESS)); res.json(_.assign(rs, returnCode.SUCCESS));
......
...@@ -299,6 +299,7 @@ exports.getByConditions = function(conditions, callback) { ...@@ -299,6 +299,7 @@ exports.getByConditions = function(conditions, callback) {
} }
//根据ID获取文章 //根据ID获取文章
exports.getThreadById = function(tid, callback) { exports.getThreadById = function(tid, callback) {
var begin = new Date().getTime();
ForumThread.findOne({_id: tid}).populate({ ForumThread.findOne({_id: tid}).populate({
path: 'from', path: 'from',
select: 'uid mid nickName icon exp honorTitles' select: 'uid mid nickName icon exp honorTitles'
...@@ -472,7 +473,7 @@ exports.getThreadById = function(tid, callback) { ...@@ -472,7 +473,7 @@ exports.getThreadById = function(tid, callback) {
// threadObj.latestPhotos = latestPhotos; // threadObj.latestPhotos = latestPhotos;
// threadObj.hotPhotos = hotPhotos; // threadObj.hotPhotos = hotPhotos;
threadObj.canyuPeopleCount = canyuPeopleCount; threadObj.canyuPeopleCount = canyuPeopleCount;
console.log("getThreadByIdTime:" + Math.abs(new Date()-end));
callback(null, threadObj); 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