Open kylokean opened 2 years ago
Running into the same issue and did some research. I'm not sure if it is the same in your case, but I noticed a lot of requests originating from a refresh
function which queries attachments:
While editing posts, admin-ajax.php
seems to be requested over and over again while the given post__in
parameter only contains an array with an empty string ([ "" ]
). As no posts are being queried and there will never be any results in this case, it is wasting server resources and this call should not be performed at all (that is probably also where uncached.length === 0
is intended for, but seems there's an issue with that check as uncached
is an array with empty strings).
As a temporary solution, I've manually changed the if
-statement in /js/yoast-acf-analysis.js
from:
if ( uncached.length === 0 )
to:
if ( uncached.length === 0 || uncached[0] === "" )
This continues to cause performance issues, it would be nice if the @Yoast team would fix this. I think my colleague @rvdsteege has already provided the solution. Because of this issue, admin-ajax.php
has been at the top of the list of most visited pages for months. Can you maybe take a look at this @enricobattocchi? 🌱
Please give us a description of what happened.
It seems that we are doing a lots of AJAX requests from the admin backend when this plugin is enabled. It causes abnormal >1000% CPU load.
We already removed image and gallery field types from scoring as described below - it reduced ajax requests but it didn't fix this problem 100% => add_filter( 'yoast-acf-analysis/blacklist_type', function ( $blacklist_type ) { $blacklist_type->add( 'image' ); $blacklist_type->add( 'gallery' ); return $blacklist_type; });
Please describe what you expected to happen and why.
We are expected to reduce ajax requests.
As a possible solution we want to try to Change refresh rate as described in your documentation => add_filter( 'Yoast\WP\ACF\refresh_rate', function () { // Refresh rates in milliseconds return 3000; });
But we need to know what is the default value (1000?), min and max values and how to easily check in browser current value of 'refresh_rate' to see that our changes applied successfully.
How can we reproduce this behavior?
Technical info