[wp-trac] [WordPress Trac] #56628: Cron memory limit is unnecessarily low
WordPress Trac
noreply at wordpress.org
Thu Sep 22 17:41:15 UTC 2022
#56628: Cron memory limit is unnecessarily low
-------------------------+-----------------------------
Reporter: iandunn | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron API | Version: 2.1
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
==== Problem
`wp-cron.php` uses the default `WP_MEMORY_LIMIT`, which is sometimes low
enough that a cron job triggers an out-of-memory error.
In many of those cases, the amount of memory needed is greater than
`WP_MEMORY_LIMIT`, but less than `WP_MAX_MEMORY_LIMIT`, and all a dev has
to do is call `wp_raise_memory_limit( 'admin' )` in their cron callback.
That still requires time debugging and fixing, though, and Core could
prevent those types of errors from happening in the first place.
==== Proposed Solution
Since crons often consume extra memory by nature, I think it makes sense
to give them the full amount available by default. We already do this with
the admin area and image processing.
That could be done by adding a new `cron` context to
`wp_raise_memory_limit()`, and calling `wp_raise_memory_limit( 'cron' )`
in `wp-cron.php`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56628>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list