Merge pull request #490 from TLSM/pr-fix-comment-perf

Fix comment eager loading
This commit is contained in:
Ben Rog-Wilhelm 2023-02-07 06:58:35 -06:00 committed by GitHub
commit 984a613868
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -235,8 +235,10 @@ def post_id(pid, anything=None, v=None, sub=None):
post.replies = get_comment_trees_eager(top_comment_ids, sort, v)
post.views += 1
g.db.expire_on_commit = False
g.db.add(post)
g.db.commit()
g.db.expire_on_commit = True
if request.headers.get("Authorization"): return post.json
else: