mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
Update link.num_comments on comment post again.
It turns out that this commit to psql takes too long, causing backlog in the comments_tree queue.
This commit is contained in:
@@ -128,12 +128,6 @@ def add_comments_nolock(link_id, comments):
|
||||
r[cm_id] = None
|
||||
# print "And I set %s -> None" % cm_id
|
||||
|
||||
# update the link's comment count and schedule it for search reindexing
|
||||
link = Link._byID(link_id, data = True)
|
||||
link._incr('num_comments', len(comments))
|
||||
from r2.lib.db.queries import changed
|
||||
changed(link)
|
||||
|
||||
g.permacache.set(key, r)
|
||||
|
||||
g.permacache.set(comments_key(link_id),
|
||||
|
||||
@@ -604,6 +604,8 @@ class Comment(Thing, Printable):
|
||||
if parent:
|
||||
c.parent_id = parent._id
|
||||
|
||||
link._incr('num_comments', 1)
|
||||
|
||||
to = None
|
||||
name = 'inbox'
|
||||
if parent:
|
||||
@@ -614,6 +616,8 @@ class Comment(Thing, Printable):
|
||||
|
||||
c._commit()
|
||||
|
||||
changed(link, True) # link's number of comments changed
|
||||
|
||||
inbox_rel = None
|
||||
# only global admins can be message spammed.
|
||||
if to and (not c._spam or to.name in g.admins):
|
||||
|
||||
Reference in New Issue
Block a user