From 602e0dabe182a3be3736f27556f93ddba8dea2d1 Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Mon, 1 Apr 2024 19:43:06 +0530 Subject: [PATCH 1/2] set timeout for 60seconds --- includes/Classifai/Providers/Azure/ComputerVision.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index dc2949016..6f9110a1a 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -610,6 +610,16 @@ protected function scan_image( string $image_url, \Classifai\Features\Feature $f 'Ocp-Apim-Subscription-Key' => $settings['api_key'], 'Content-Type' => 'application/json', ], + /** + * Filters the timeout for the image scan request. + * Default: 60 seconds. + * + * @param int $timeout Timeout in seconds. + */ + 'timeout' => apply_filters( + 'classifai_' . self::ID . '_scan_image_timeout', + 60 + ), 'body' => '{"url":"' . $image_url . '"}', ] ); From a90aef45cbb47413bfb1e68563fb024106fd2f11 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Tue, 2 Apr 2024 07:40:47 -0600 Subject: [PATCH 2/2] Update docblock --- includes/Classifai/Providers/Azure/ComputerVision.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 6f9110a1a..3b7cd3d88 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -612,9 +612,15 @@ protected function scan_image( string $image_url, \Classifai\Features\Feature $f ], /** * Filters the timeout for the image scan request. + * * Default: 60 seconds. * - * @param int $timeout Timeout in seconds. + * @since 3.1.0 + * @hook classifai_ms_computer_vision_scan_image_timeout + * + * @param {int} $timeout Timeout in seconds. + * + * @return {int} Timeout in seconds. */ 'timeout' => apply_filters( 'classifai_' . self::ID . '_scan_image_timeout',