Remove some of the block pattern caching#5495
Remove some of the block pattern caching#5495spacedmonkey wants to merge 2 commits intoWordPress:trunkfrom
Conversation
felixarntz
left a comment
There was a problem hiding this comment.
Thanks @spacedmonkey, the approach certainly helps detecting new and deleted patterns, but it's not a proper solution for the root of the issue. When a pattern is updated, it will still be in the cache.
FWIW I disagree that any of these changes need to be made. This is a half baked solution. Either we should be able to rely on WP_DEVELOPMENT_MODE, or we should not (in which case all of the block theme file caching in core would need to be reverted/removed).
Despite the above, what you're doing here partially addresses the concerns on the ticket, so I'm not strongly opposed to merging this as a small improvement. But we should have unit tests to make sure it doesn't introduce problems, especially this late in the cycle.
@felixarntz You mind doing some performance profiling on this change? I believe one glob is better than 50 files exist for performance. Sadly I will not have time to work on this, as I am busy with other things. |
Scale back on the caching of block patterns. Still do glob on every request. This way the code can easily detect the remove and adding of files in this directory.
Trac ticket: https://core.trac.wordpress.org/ticket/59591
Trac ticket: https://core.trac.wordpress.org/ticket/59633
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.