Skip to content

Commit

Permalink
WPCOM_JSON_API_List_Comments_Endpoint: Do not prefetch comment meta f…
Browse files Browse the repository at this point in the history
…or large hierarchical threads (#36460)

* WPCOM_JSON_API_List_Comments_Endpoint: Do not prefetch comment meta for large hierarchical threads

* changelog
  • Loading branch information
mreishus authored Mar 19, 2024
1 parent fa68981 commit f4c805e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

WPCOM_JSON_API_List_Comments_Endpoint: Do not prefetch comment meta for large hierarchical threads
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ public function callback( $path = '', $blog_id = 0, $object_id = 0 ) {
}
}
}
if ( $args['hierarchical'] && $found > 5000 ) {
// Massive comment thread found; don't pre-load comment metadata to reduce memory used.
$query['update_comment_meta_cache'] = false;
}

if ( $post_id ) {
$post = get_post( $post_id );
Expand Down

0 comments on commit f4c805e

Please sign in to comment.