Skip to content

Commit e06121f

Browse files
committed
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 git-svn-id: https://develop.svn.wordpress.org/trunk@44488 602fd350-edb4-49c9-b593-d223f7449a82
1 parent bd74154 commit e06121f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/wp-cron.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
ignore_user_abort( true );
2020

21+
/* Don't make the request block till we finish, if possible. */
22+
if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
23+
fastcgi_finish_request();
24+
}
25+
2126
if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
2227
die();
2328
}

0 commit comments

Comments
 (0)