MinnPost / object-sync-for-salesforce

WordPress plugin that maps and syncs data between Salesforce objects and WordPress objects.
https://wordpress.org/plugins/object-sync-for-salesforce/
GNU General Public License v2.0
94 stars 51 forks source link

ActionScheduler_wpCommentLogger->get_comment_count Causing Performance Issues #398

Closed timnolte closed 2 years ago

timnolte commented 3 years ago

Describe the bug I'm wondering if this will be resolved in the Action Scheduler upgrade or how to resolve the fact that I'm seeing major site performance issues with Action Scheduler calling ActionScheduler_wpCommentLogger->get_comment_count which is running:

SELECT comment_approved, COUNT( * ) AS num_comments
FROM wp_comments
WHERE comment_type NOT IN('order_note','action_log')
GROUP BY comment_approved

I'm seeing this reported by Query Monitor.

To Reproduce Steps to reproduce the behavior:

  1. Install Query Montior.
  2. Load Post Type editing screens in the Dashboard.
  3. Observe warning about slow running query.

Expected behavior This shouldn't even be running when Post Types don't even have comments turned on.

Environment (please complete the following information):

Additional context I don't have anything else that is using the Action Scheduler library installed this is only what is being provided by the Object Sync plugin.

jonathanstegall commented 3 years ago

If you've got the capacity to test it, there's a branch with the current Action Scheduler version. I have only done minimal testing with it, and it's a major upgrade for that library so it would be good to get multiple tests. See the #395 pull request.

jonathanstegall commented 3 years ago

To give a slightly longer response, @timnolte, I'm not sure that the 3.x upgrade of Action Scheduler will fix your specific problem to the extent that it's no longer marked by Query Monitor as a "slow running query" but I do know that the 3.x version was done partly for performance reasons. WordPress certainly does have various queries that Query Monitor marks that way in my experience; it's possible that this will still be one of them. But it's worth finding out!

jonathanstegall commented 2 years ago

@timnolte It would be good to know if you find that 2.x versions still have this issue.

timnolte commented 2 years ago

@timnolte It would be good to know if you find that 2.x versions still have this issue.

@jonathanstegall I'll dig in this next week to see what impact it's made. Thanks!

jonathanstegall commented 2 years ago

I'm going to close this for now, but am happy for it to be reopened/updated (or for a new issue to be created, if that is more accurate) if this issue persists now after sites have had time with Action Scheduler's later versions.