[wp-trac] [WordPress Trac] #34560: High memory usage ( and possible server error) editing post with many/large revisions
WordPress Trac
noreply at wordpress.org
Tue Mar 5 16:05:41 UTC 2019
#34560: High memory usage ( and possible server error) editing post with many/large
revisions
-------------------------------------+-------------------------------------
Reporter: pdfernhout | Owner: adamsilverstein
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Future Release
Component: Revisions | Version: 3.6
Severity: major | Resolution:
Keywords: needs-unit-tests has- | Focuses: administration,
patch dev-feedback needs-testing | performance
-------------------------------------+-------------------------------------
Comment (by adamsilverstein):
@mikeyarce thanks for the ping and offer of help. Reviewing this ticket
after a gap of time I feel like the existing patch tried to tackle too
much. I would like to break down the code here into several discrete
patches to accomplish each individual fix:
* Optimize `wp_get_post_autosave`with a direct query instead of loading
all revisions and looping thru them to find the user's autosave
* When determining if the revisions meta box should be shown, use a count
query instead of loading all revisions and counting them
* when displaying the metabox, use a direct query to determine the last
revision, instead of loading all revisions and grabbing the last one.
Based on previous discussions, I'm not sure
`wp_get_post_revisions_details` is viable: because the query grabs only
certain post details, it may result in an incomplete cache of those posts
data, potentially causing issues for example on the revisions screen where
additional post details are needed.
On a related note, this ticket raises the issue of how we handle revisions
in the block editor. Long term I envision a much more modern revisions
integration into the editor - for now we leverage the existing revisions
screen and mainly need to check if revisions are available (and how many),
and the latest one.
We use two selectors for this and we should verify these work efficiently
even with many large revisions, looks like they leverage data from the
REST API:
`getCurrentPostRevisionsCount` -
https://github.com/WordPress/gutenberg/blob/c29b729a6d107fc5a7ef53efafda126d6fbb68e0/packages/editor/src/store/selectors.js#L177-L186
`getCurrentPostLastRevisionId` -
https://github.com/WordPress/gutenberg/blob/c29b729a6d107fc5a7ef53efafda126d6fbb68e0/packages/editor/src/store/selectors.js#L188-L198
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34560#comment:68>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list