[wp-trac] [WordPress Trac] #58470: Add configurable batching to `wp_scheduled_delete` for controlling cleanup operations
WordPress Trac
noreply at wordpress.org
Tue Jun 6 22:08:46 UTC 2023
#58470: Add configurable batching to `wp_scheduled_delete` for controlling cleanup
operations
-------------------------+-----------------------------
Reporter: johnrom | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version: trunk
Severity: normal | Keywords:
Focuses: performance |
-------------------------+-----------------------------
When posts are trashed, they are automatically cleaned up by the
`wp_scheduled_delete` wp-cron task. However, both the frequency that this
cron task runs and the number of posts that can be cleaned up at once time
lack configurability.
Imagine a shop which has more than 100,000 orders: trashing thousands or
tens of thousands of them at once could cause the website to become
unresponsive when it comes time to clean up the trash.
I suggest adding two constants:
||= Constant Name =||= Default Value =||= Description =||
|| `EMPTY_TRASH_SCHEDULE` || `daily` || The cron schedule on which the
trash scheduler runs. This is useful for increasing the number of times
the cleanup process runs when using batching to delete many posts. ||
|| `EMPTY_TRASH_BATCH_SIZE` || `50` || The maximum number of posts to
delete at once. ||
It may also be useful for these and `EMPTY_TRASH_DAYS` to have filters to
improve cleanup operations overall.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58470>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list