Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue with too many calls to admin-ajax. #128

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

fmolina24
Copy link

Summary

This PR can be summarized in the following changelog entry:

  • Seems that unnecessary calls where being made to query_attachments it was making calls even when the attachment ids were empty.
  • The issue was when the attachment_id value was getting fetched there was no check to see if it was empty before it was added into the array which made the attachment_ids never empty.
  • Added validation before attachment_id gets added to array.

Test instructions

  • Visit edit post page and make sure unnecessary calls are not made to the action query_attachments.

Fixes #

@fmolina24
Copy link
Author

Travis CI build is failing due to maximum warnings reached seems the more instances attachment_id of brought it over the max.

@kraftner
Copy link
Contributor

Thanks for your PR! 🎉
I only had a quick look at it and it seems as if the check is probably better done in the cache itself as an empty ID never makes sense.
Also I'd like to find out why there are empty IDs in the first place. I think this still needs some work although it is a great start.

@fmolina24
Copy link
Author

@kraftner Moved the check into the cache refresh function. The empty id seem to to happen due to an image has not been set on a image field or gallery field the value is empty when the scrapper gets to it.

@fisaman
Copy link

fisaman commented Nov 28, 2020

Hi,
i still have the problem.

Too much get-attachement admin-ajax.php requests with yoasts plugin enabled

When I edit a page of the site the loading time is very high and the consumption of RAM and CPU is also very high.

In the network inspector I see that there are too many requests to the admin-ajax.php script with the get-attachment method.

This happens when I have the Yoast SEO plugin activated, if I deactivate Yoast these requests are not made.

I have all the plugins updated.

Screenshot: https://pasteboard.co/JCttWFz.jpg https://pasteboard.co/JCtu9kf.jpg

How can I solve?

---- Configuration ----
Theme The7 v.9.3.1
The7 WPBackery Page Builder 6.4.2
Ultimate Addons for WPBakery Page Builder 3.19.7
Yoast SEO 15.3

I tried PHP 7.2, 7.3 and 7.4
PHP Max Input Vars: 10000
PHP Memory Limit: 512 MB
PHP Time Limit: 360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants