diff --git a/files/class-api-client.php b/files/class-api-client.php index ca617d710b..b22eab1f62 100644 --- a/files/class-api-client.php +++ b/files/class-api-client.php @@ -199,12 +199,21 @@ public function get_file( $file_path ) { return $file; } + // calculate timeout + $info = array(); + $this->is_file( $file_path, $info ); + if ( is_wp_error( $info ) ) { + return $info; + } + + $request_timeout = $this->calculate_upload_timeout( $info['size'] ); $tmp_file = $this->cache->create_tmp_file(); // Request args for wp_remote_request() $request_args = [ 'stream' => true, 'filename' => $tmp_file, + 'timeout' => $request_timeout, ]; // not in cache so get from API