Skip to content

Commit f96e763

Browse files
authored
Merge pull request #927 from cloudinary/fix/eager-timeout
add additional timeout for each inline transformation
2 parents c92da93 + e1b0d5d commit f96e763

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

php/connect/class-api.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,16 @@ private function call( $url, $args = array(), $method = 'get' ) {
984984
}
985985

986986
// Set a long-ish timeout since uploads can be 20mb+.
987-
$args['timeout'] = 60; // phpcs:ignore
987+
$args['timeout'] = 90; // phpcs:ignore
988+
989+
// Adjust timeout for additional eagers if image_freeform or video_freeform is set.
990+
if ( ! empty( $args['body']['resource_type'] ) ) {
991+
$freeform = $this->media->get_settings()->get_value( $args['body']['resource_type'] . '_freeform' );
992+
if ( ! empty( $freeform ) ) {
993+
$timeout_multiplier = explode( '/', $freeform );
994+
$args['timeout'] += 60 * count( $timeout_multiplier ); // phpcs:ignore
995+
}
996+
}
988997

989998
$request = wp_remote_request( $url, $args );
990999
if ( is_wp_error( $request ) ) {

0 commit comments

Comments
 (0)