WordPress Real Cron Change timeout issue
Im running a large script which takes approx 2-3 mins to complete. The script loops through our woocommerce products and updates them where necessary.
The problem I’m having is when the CRON job is scheduled to run the script times out, with no errors (wp-debug included).
However, if you manually execute the same scheduled script using “Advanced Cron Manager” everything runs fine and the script completes without timing out.
Im a little confused as to what is limiting the scripts runtime as my site php.ini has max_execution_time: 300
, max_input_time: 300
, post_max_size: 256M
I thought that using define('WP_CRON_LOCK_TIMEOUT', 300);
might have helped but it didn’t.
Im not sure if it’s relevant but to allow the script to run through the Cloudflare servers and avoid a timeout there I had to use PHP’s output buffering to make the script return something after each product has been looked at?
Leave an answer