Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
babeb4cf
Commit
babeb4cf
authored
Jul 28, 2016
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加耗时Log
parent
88744e39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
forumThread.js
app/controllers/mobile/forumThread.js
+1
-1
forumThreadService.js
app/service/forumThreadService.js
+5
-1
No files found.
app/controllers/mobile/forumThread.js
View file @
babeb4cf
...
...
@@ -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
];
}
...
...
app/service/forumThreadService.js
View file @
babeb4cf
...
...
@@ -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
);
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment