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

增加耗时Log

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