Cron API: Attempt to raise the PHP memory limit for cron event processing.

Since cron events often consume extra memory by nature, it makes sense to give them the full amount available by default. In practice this means the memory will be increased to `WP_MAX_MEMORY_LIMIT` (which is 256MB by default) during cron event processing if the default memory limit is lower than this value.

The new `cron_memory_limit` filter can be used to adjust this value if necessary.

Note that this change will not by default affect external means of processing cron events, such as the `wp cron` command in WP-CLI, server-level crontab events, or any other cron event processing mechanism that bypasses `wp-cron.php`.

Props iandunn, thakkarhardik

Fixes #56628


git-svn-id: https://develop.svn.wordpress.org/trunk@55871 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2023-05-30 18:46:58 +00:00
parent c9f3a68281
commit 240f914e4f
2 changed files with 19 additions and 1 deletions
+3
View File
@@ -46,6 +46,9 @@ if ( ! defined( 'ABSPATH' ) ) {
require_once __DIR__ . '/wp-load.php';
}
// Attempt to raise the PHP memory limit for cron event processing.
wp_raise_memory_limit( 'cron' );
/**
* Retrieves the cron lock.
*