-
Notifications
You must be signed in to change notification settings - Fork 384
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
Asynchronously populate counts for unreviewed validation errors and validated URLs in admin menu and dashboard widget #5772
Comments
I don't think the cron job will work because it needs to be live. In other words, if you have just 1 validated URL left that has an unreviewed error, you'll see a (1) next to Validated URLs as well as some other number next to Error Index (x). When you save update the status of a validation error from Unreviewed to Reviewed, the result is that these two numbers should decrement right away. It should be the same behavior as the bubbles next to Comments when there are unmoderated comments, and Plugins when there are updates available. These update immediately upon moderation and update respectively. What could be done is to introduce a REST API endpoint for fetching the counts count of validated URLs containing unreviewed errors, as well as the count of unreviewed errors in the error index. If this were available, then we could do a request for those fields to then populate the menu item accordingly. Upon the first page load, the fetched numbers could be stored in |
Note the counts themselves are cached in transients per #3222, #3666, and #5343. However, when an update is made to a validated URL then the cache is invalidated. @maciejmackowiak Are you seeing this slow query with every page load, or just after AMP validated data has been changed? |
We have Query Monitor enabled on production for only admins, and this amp query is there all the time throughout the day. It's definitely not every time I load wp admin, but I notice it enough times for it to become frustrating. We have a busy site with lots of posts getting published and updated daily. |
Ajax all the things! |
We can also consider making the request only when we need. So if the user is not even on an AMP settings screen, we can skip making the requests until the user opens the AMP admin submenu. |
Forwarding to @pierlon! |
Feature description
We have noticed a huge performance impact from the query used for populating unread AMP validated urls/validation errors count.
It sometimes adds 0.3-0.5s to wp-admin page load.
Could you please consider moving it to cron job?
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: