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:
Logan Hanks
2011-06-21 13:47:52 -07:00
parent 959c3aa207
commit 5b9de9cb48
2 changed files with 4 additions and 6 deletions

View File

@@ -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),

View File

@@ -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):