Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
3d902ee8
Commit
3d902ee8
authored
Aug 23, 2016
by
Toby Lawrence
Committed by
GitHub
Aug 23, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #202 from edx/perf/tracing-and-consistency
Add more tracing + code cleanup.
parents
1f4b77a9
01bd17bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
4 deletions
+9
-4
api/comment_threads.rb
+1
-2
models/comment.rb
+4
-0
models/comment_thread.rb
+3
-1
presenters/thread_utils.rb
+1
-1
No files found.
api/comment_threads.rb
View file @
3d902ee8
get
"
#{
APIPREFIX
}
/threads"
do
# retrieve threads by course
get
"
#{
APIPREFIX
}
/threads"
do
# retrieve threads by course
threads
=
CommentThread
.
where
({
"course_id"
=>
params
[
"course_id"
]})
threads
=
Content
.
where
({
"_type"
=>
"CommentThread"
,
"course_id"
=>
params
[
"course_id"
]})
if
params
[
:commentable_ids
]
if
params
[
:commentable_ids
]
threads
=
threads
.
in
({
"commentable_id"
=>
params
[
:commentable_ids
].
split
(
","
)})
threads
=
threads
.
in
({
"commentable_id"
=>
params
[
:commentable_ids
].
split
(
","
)})
end
end
...
...
models/comment.rb
View file @
3d902ee8
require
'new_relic/agent/method_tracer'
require_relative
'content'
require_relative
'content'
require_relative
'constants'
require_relative
'constants'
...
@@ -164,4 +165,7 @@ class Comment < Content
...
@@ -164,4 +165,7 @@ class Comment < Content
self
.
sk
=
(
self
.
parent_ids
.
dup
<<
self
.
id
).
join
(
"-"
)
self
.
sk
=
(
self
.
parent_ids
.
dup
<<
self
.
id
).
join
(
"-"
)
end
end
end
end
include
::
NewRelic
::
Agent
::
MethodTracer
add_method_tracer
:to_hash
end
end
models/comment_thread.rb
View file @
3d902ee8
...
@@ -133,7 +133,6 @@ class CommentThread < Content
...
@@ -133,7 +133,6 @@ class CommentThread < Content
"group_id"
=>
group_id
,
"group_id"
=>
group_id
,
"pinned"
=>
pinned?
,
"pinned"
=>
pinned?
,
"comments_count"
=>
comment_count
)
"comments_count"
=>
comment_count
)
end
end
def
comment_thread_id
def
comment_thread_id
...
@@ -162,4 +161,7 @@ class CommentThread < Content
...
@@ -162,4 +161,7 @@ class CommentThread < Content
def
destroy_subscriptions
def
destroy_subscriptions
subscriptions
.
delete_all
subscriptions
.
delete_all
end
end
include
::
NewRelic
::
Agent
::
MethodTracer
add_method_tracer
:to_hash
end
end
presenters/thread_utils.rb
View file @
3d902ee8
...
@@ -31,7 +31,7 @@ module ThreadUtils
...
@@ -31,7 +31,7 @@ module ThreadUtils
unread_comment_count
=
Comment
.
collection
.
find
(
unread_comment_count
=
Comment
.
collection
.
find
(
:comment_thread_id
=>
t
.
_id
,
:comment_thread_id
=>
t
.
_id
,
:author_id
=>
{
"$ne"
=>
user
.
id
},
:author_id
=>
{
"$ne"
=>
user
.
id
},
:updated_at
=>
{
"$gte"
=>
read_dates
[
thread_key
]}
:updated_at
=>
{
"$gte"
=>
read_dates
[
thread_key
]}
,
).
count
).
count
read_states
[
thread_key
]
=
[
is_read
,
unread_comment_count
]
read_states
[
thread_key
]
=
[
is_read
,
unread_comment_count
]
end
end
...
...
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