[wp-trac] [WordPress Trac] #63547: wp_remote_post not respecting timeout & blocking params
WordPress Trac
noreply at wordpress.org
Mon Jun 9 04:03:42 UTC 2025
#63547: wp_remote_post not respecting timeout & blocking params
--------------------------+--------------------------
Reporter: mihai200 | Owner: westonruter
Type: defect (bug) | Status: accepted
Priority: normal | Milestone:
Component: HTTP API | Version: 6.7.2
Severity: normal | Resolution:
Keywords: | Focuses: performance
--------------------------+--------------------------
Comment (by westonruter):
Another workaround could be to spawn WP Cron at `shutdown` instead of at
`wp_loaded`. I'm not sure why `wp_loaded` was chosen to begin with:
{{{#!php
<?php
/**
* Plugin Name: WP Cron Perf Fix
*/
namespace WPCronPerfFix;
use CurlHandle;
// Facilitate testing the performance impact by disabling with a query
parameter.
if ( isset( $_GET['disable_wp_cron_perf_fix'] ) || defined( 'WP_CLI' ) ) {
return;
}
/**
* Spawns WP Cron at shutdown.
*/
function spawn_wp_cron_at_shutdown() {
// Make sure response is flushed so the TTFB hopefully will get
marked here even if the following finish requests aren't available.
flush();
// End the response, as is done in wp-cron.php.
if ( function_exists( 'fastcgi_finish_request' ) ) {
fastcgi_finish_request();
} elseif ( function_exists( 'litespeed_finish_request' ) ) {
litespeed_finish_request();
}
_wp_cron();
}
// Move WP Cron from being spawned at wp_loaded to happen at shutdown
instead.
if ( has_action( 'init', 'wp_cron' ) ) {
remove_action( 'init', 'wp_cron' );
add_action( 'shutdown', __NAMESPACE__ .
'\spawn_wp_cron_at_shutdown' );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63547#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list