Make WordPress Core

Changeset 44488


Ignore:
Timestamp:
01/09/2019 01:05:16 AM (6 years ago)
Author:
tellyworth
Message:

Cron API: Make wp-cron.php non-blocking where possible.

This should make cron spawning faster by ensuring requests to wp-cron.php return immediately regardless of transport method. It is enabled only on recent PHP versions with fastcgi, due to historical bugs and availability of fastcgi_finish_request(). This needs testing on a range of platforms, to help determine if it's safe to use in other contexts also.

Props vnsavage, johnbillion, jnylen0.
See #18738, #41358

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-cron.php

    r44483 r44488  
    1818
    1919ignore_user_abort( true );
     20
     21/* Don't make the request block till we finish, if possible. */
     22if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
     23    fastcgi_finish_request();
     24}
    2025
    2126if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
Note: See TracChangeset for help on using the changeset viewer.