Bug or not?? bp_get_forum_topic_count causing massive memory requirements and timeouts
-
I previously reported that the BuddyPress /forums page (“Group Forums Directory”) was crashing due to memory limit errors on a BP Forum that had 20,000+ topics.
I kept bumping it up until I finally got the page to render at a memory limit of 200M. The problem is the function bp_get_forum_topic_count is causing massive memory requirements and timeouts. This function that displays the total number of topics in the tab: “All Topics (23,466)” Even with the memory limit high enough, bp_get_forum_topic_count takes a good 4 seconds to generate that number (on a VPS that otherwise pulls up pages in a fraction of a second) so I’m not keen to use this function on page that’s going to be pulled thousands of times per day.
So now I’m wondering why this function even exists?? The weird thing is that bp_forum_pagination_count() performs a similar function directly below the All Topics tab (“Viewing topic 1 to 20 (23,466 total topics)”) and that function is instantaneous; no waiting. This function works by calling another function to generate the total topic count: bp_core_number_format( $forum_template->total_topic_count )
Pretty sure this should be filed as a bug but wanted to see if anyone else had thoughts on this? Given that total_topic_count is already stored in the $forum_template, is bp_get_forum_topic_count a dog that serves no purpose and causes massive memory issues to boot?
- The topic ‘Bug or not?? bp_get_forum_topic_count causing massive memory requirements and timeouts’ is closed to new replies.