Skip to content

Commit f995de4

Browse files
Seperate API timeout and connect timeout
1 parent cd56cab commit f995de4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/class-tiny-compress-client.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class Tiny_Compress_Client extends Tiny_Compress {
3636
* @since 3.6.8
3737
* @var int
3838
*/
39-
const API_TIMEOUT = 300;
39+
const API_TIMEOUT = 120;
40+
const CONNECT_TIMEOUT = 8;
4041

4142
private $last_error_code = 0;
4243
private $last_message = '';
@@ -186,7 +187,7 @@ private function set_request_options( $client ) {
186187

187188
// Set API request timeout to prevent indefinite hanging
188189
$options[ CURLOPT_TIMEOUT ] = self::API_TIMEOUT;
189-
$options[ CURLOPT_CONNECTTIMEOUT ] = self::API_TIMEOUT;
190+
$options[ CURLOPT_CONNECTTIMEOUT ] = self::CONNECT_TIMEOUT;
190191

191192
if ( TINY_DEBUG ) {
192193
$file = fopen( dirname( __FILE__ ) . '/curl.log', 'w' );

0 commit comments

Comments
 (0)