Skip to content

Commit 1ff9261

Browse files
committed
Cron API: Make wp-cron non-blocking for LiteSpeed LSAPI.
This should make cron spawning faster on LSAPI by ensuring that cron requests return immediately. To avoid code repetition, the no caching headers are relocated and always sent. Caching plugins attempting to set these headers later will replace those set by WordPress Core. Follow up to [44488]. Props maximej, johnbillion. Fixes #54668. git-svn-id: https://develop.svn.wordpress.org/trunk@53653 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 59a99c1 commit 1ff9261

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/wp-cron.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818

1919
ignore_user_abort( true );
2020

21+
if ( ! headers_sent() ) {
22+
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
23+
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
24+
}
25+
2126
/* Don't make the request block till we finish, if possible. */
2227
if ( PHP_VERSION_ID >= 70016 && function_exists( 'fastcgi_finish_request' ) ) {
23-
if ( ! headers_sent() ) {
24-
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
25-
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
26-
}
27-
2828
fastcgi_finish_request();
29+
} elseif ( function_exists( 'litespeed_finish_request' ) ) {
30+
litespeed_finish_request();
2931
}
3032

3133
if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {

0 commit comments

Comments
 (0)