From 8b324c5e992c877516ec2117aa731fe4672eaec8 Mon Sep 17 00:00:00 2001 From: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:18:56 +0300 Subject: [PATCH 1/3] added default timeout for requests to ExApps that does not set it Signed-off-by: Alexander Piskun --- lib/Service/AppAPIService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Service/AppAPIService.php b/lib/Service/AppAPIService.php index e14f8f05..4011e735 100644 --- a/lib/Service/AppAPIService.php +++ b/lib/Service/AppAPIService.php @@ -193,6 +193,9 @@ private function prepareRequestToExApp( if (!empty($auth)) { $options['auth'] = $auth; } + if (!isset($options['timeout'])) { + $options['timeout'] = '3.0'; + } if ((!array_key_exists('multipart', $options)) && (count($params)) > 0) { if ($method === 'GET') { From ced46d9a1adfce68b719d23456e6aef1b5af4829 Mon Sep 17 00:00:00 2001 From: Andrey Borysenko Date: Wed, 10 Jul 2024 15:08:28 +0300 Subject: [PATCH 2/3] set timeout to 30s for enabled/disabled Signed-off-by: Andrey Borysenko --- lib/Service/AppAPIService.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Service/AppAPIService.php b/lib/Service/AppAPIService.php index 4a07cd3d..8b54ab70 100644 --- a/lib/Service/AppAPIService.php +++ b/lib/Service/AppAPIService.php @@ -236,7 +236,7 @@ private function prepareRequestToExApp( $options['auth'] = $auth; } if (!isset($options['timeout'])) { - $options['timeout'] = '3.0'; + $options['timeout'] = 3; } if ((!array_key_exists('multipart', $options)) && (count($params)) > 0) { @@ -284,6 +284,9 @@ private function prepareRequestToExApp2( if (!empty($auth)) { $options['auth'] = $auth; } + if (!isset($options['timeout'])) { + $options['timeout'] = 3; + } if ((!array_key_exists('multipart', $options))) { if (count($queryParams) > 0) { @@ -661,7 +664,7 @@ public function getExAppDomain(ExApp $exApp): string { */ public function enableExApp(ExApp $exApp): bool { if ($this->exAppService->enableExAppInternal($exApp)) { - $exAppEnabled = $this->requestToExApp($exApp, '/enabled?enabled=1', null, 'PUT'); + $exAppEnabled = $this->requestToExApp($exApp, '/enabled?enabled=1', null, 'PUT', options: ['timeout' => 30]); if ($exAppEnabled instanceof IResponse) { $response = json_decode($exAppEnabled->getBody(), true); if (empty($response['error'])) { @@ -686,7 +689,7 @@ public function enableExApp(ExApp $exApp): bool { */ public function disableExApp(ExApp $exApp): bool { $result = true; - $exAppDisabled = $this->requestToExApp($exApp, '/enabled?enabled=0', null, 'PUT'); + $exAppDisabled = $this->requestToExApp($exApp, '/enabled?enabled=0', null, 'PUT', options: ['timeout' => 30]); if ($exAppDisabled instanceof IResponse) { $response = json_decode($exAppDisabled->getBody(), true); if (isset($response['error']) && strlen($response['error']) !== 0) { From 3262fc6c0e24476c2c78b631774912a57cea6522 Mon Sep 17 00:00:00 2001 From: Andrey Borysenko Date: Wed, 10 Jul 2024 15:08:42 +0300 Subject: [PATCH 3/3] bump version, update changelog Signed-off-by: Andrey Borysenko --- CHANGELOG.md | 3 ++- appinfo/info.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56859925..68de0f72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [2.7.1 - 2024-07-xx] +## [2.8.0 - 2024-07-1x] ### Added - New OCS API endpoint to setAppInitProgress. The old one is marked as deprecated. #319 +- Added default timeout for requestToExApp function set to 3s. #277 ### Fixed diff --git a/appinfo/info.xml b/appinfo/info.xml index 998a2522..063c6ced 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -43,7 +43,7 @@ to join us in shaping a more versatile, stable, and secure app landscape. *Your insights, suggestions, and contributions are invaluable to us.* ]]> - 2.7.1 + 2.8.0 agpl Andrey Borysenko Alexander Piskun