Stop killing other plugins remote requests - Remove http_request_timeout filter and callback

Removed the http_request_timeout filter and its callback function. Set a timeout value directly in the wp_remote_get call.

This will stop your plugin from affecting ALL WordPress remote calls, either from core or other plugins or API calls, and set the 2-second timeout ONLY for your own wp_remote_get call.

I just spent one hour debugging a customer website that could not make end API calls because your plugin was killing all connections after 2 seconds.
This commit is contained in:
Marco Almeida
2025-12-17 13:45:23 +00:00
committed by GitHub
parent ce77bab1a1
commit d59d37f451

View File

@@ -53,9 +53,6 @@ class Updater {
add_filter( 'plugins_api', array( $this, 'get_plugin_info' ), 10, 3 ); add_filter( 'plugins_api', array( $this, 'get_plugin_info' ), 10, 3 );
add_filter( 'upgrader_post_install', array( $this, 'upgrader_post_install' ), 10, 3 ); add_filter( 'upgrader_post_install', array( $this, 'upgrader_post_install' ), 10, 3 );
// set timeout
add_filter( 'http_request_timeout', array( $this, 'http_request_timeout' ) );
// set sslverify for zip download // set sslverify for zip download
add_filter( 'http_request_args', array( $this, 'http_request_sslverify' ), 10, 2 ); add_filter( 'http_request_args', array( $this, 'http_request_sslverify' ), 10, 2 );
} }
@@ -120,17 +117,6 @@ class Updater {
} }
/**
* Callback fn for the http_request_timeout filter
*
* @since 1.0
* @return int timeout value
*/
public function http_request_timeout() {
return 2;
}
/** /**
* Callback fn for the http_request_args filter * Callback fn for the http_request_args filter
* *
@@ -215,7 +201,8 @@ class Updater {
$query = add_query_arg( array( 'access_token' => $this->config['access_token'] ), $query ); $query = add_query_arg( array( 'access_token' => $this->config['access_token'] ), $query );
$raw_response = wp_remote_get( $query, array( $raw_response = wp_remote_get( $query, array(
'sslverify' => $this->config['sslverify'] 'sslverify' => $this->config['sslverify'],
'timeout' => 2,
) ); ) );
return $raw_response; return $raw_response;
@@ -400,4 +387,4 @@ class Updater {
return $result; return $result;
} }
} }