Phuks-co / throat

Open Source link aggregator and discussion platform powering Phuks
https://phuks.co
MIT License
73 stars 32 forks source link

Stop querying the database for every comment in get_comment_tree #269

Closed happy-river closed 3 years ago

happy-river commented 3 years ago

I noticed that one of our posts with a deeply nested discussion in the comments was reporting 154 queries to construct the response to view_post, which seemed excessive. I tracked it down to a query added by #75 to the loop in get_comment_tree. The query is called for every comment in the tree, and its only purpose is to get the sid, and since all the callers of get_comment_tree already know the sid, I was able to add it as a new argument and remove the query entirely.