Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 20 months ago

#55592 closed enhancement (fixed)

Prime caches for featured images in post rest api controller

Reported by: spacedmonkey's profile spacedmonkey Owned by: spacedmonkey's profile spacedmonkey
Milestone: 6.1 Priority: normal
Severity: normal Version: 4.2
Component: REST API Keywords: has-patch commit has-unit-tests has-dev-note
Focuses: rest-api, performance Cc:

Description

In the post api controller, if the post type supports thumbnails, this results a query to be run for each post's thumbnail. For a REST API request with 100 posts in it, this can result in lots of queries. In core there is already a function called update_post_thumbnail_cache, used to prime post thumbnails. However, this does not seem to be fired here. A simple fix would be to fire update_post_thumbnail_cache in the post controller.

Change History (17)

#1 @spacedmonkey
2 years ago

  • Owner set to spacedmonkey
  • Status changed from new to assigned

#3 @peterwilsoncc
2 years ago

  • Focuses performance added

This ticket was mentioned in Slack in #hosting-community by javier. View the logs.


2 years ago

This ticket was mentioned in Slack in #hosting-community by javier. View the logs.


2 years ago

This ticket was mentioned in Slack in #hosting-community by jadonn. View the logs.


2 years ago

This ticket was mentioned in Slack in #hosting-community by javier. View the logs.


2 years ago

This ticket was mentioned in Slack in #hosting-community by jadonn. View the logs.


2 years ago

#9 @TimothyBlynJacobs
2 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 6.1

Great find.

#10 @spacedmonkey
2 years ago

  • Keywords has-unit-tests added

@TimothyBlynJacobs Have added a unit tests. Are you happy for me to commit?

#12 @spacedmonkey
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 53499:

REST API: Prime caches for featured images in post controller.

Ensure that featured image caches are primed for post collections in the post REST API controller, by calling the update_post_thumbnail_cache function.

Props Spacedmonkey, TimothyBlynJacobs, mitogh.
Fixes #55592.

#14 @desrosj
21 months ago

  • Keywords needs-dev-note added

There are a lot of caching related changes in 6.1 and a dev note should be written collecting them all. Marking this for inclusion.

This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.


20 months ago

#16 @spacedmonkey
20 months ago

Early draft of a dev note can be found here.

Note: See TracTickets for help on using tickets.