diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index 24876675d6037..9bc5f831aae7b 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -67,7 +67,7 @@ protected function fetch($ETag, $content, $allowUnstable = false) { } $options = [ - 'timeout' => 60, + 'timeout' => (int)$this->config->getAppValue('settings', 'appstore-timeout', '120') ]; if ($ETag !== '') { diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index a6dd801aca839..7697dbd4f22c9 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -2133,7 +2133,7 @@ public function testGetAppsAllowlist(): void { ->expects($this->once()) ->method('get') ->with('https://apps.nextcloud.com/api/v1/apps.json', [ - 'timeout' => 60, + 'timeout' => 120, 'headers' => [ 'X-NC-Subscription-Key' => 'subscription-key', ], @@ -2191,6 +2191,12 @@ public function testGetAppsAllowlistCustomAppstore(): void { ->method('getSystemValueBool') ->willReturnArgument(1); + $this->config->method('getAppValue') + ->willReturnMap([ + ['settings', 'appstore-fetcher-lastFailure', '0', '0'], + ['settings', 'appstore-timeout', '120', '120'], + ]); + $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); $folder @@ -2218,7 +2224,7 @@ public function testGetAppsAllowlistCustomAppstore(): void { ->expects($this->once()) ->method('get') ->with('https://custom.appsstore.endpoint/api/v1/apps.json', [ - 'timeout' => 60, + 'timeout' => 120, ]) ->willReturn($response); $response diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php index a5a9cc7397481..bd2d627bf8bbd 100644 --- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php +++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php @@ -443,6 +443,12 @@ public function testGetMatchingETag(): void { $this->config->method('getSystemValueBool') ->willReturnArgument(1); + $this->config->method('getAppValue') + ->willReturnMap([ + ['settings', 'appstore-fetcher-lastFailure', '0', '0'], + ['settings', 'appstore-timeout', '120', '120'], + ]); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -488,7 +494,7 @@ public function testGetMatchingETag(): void { ->with( $this->equalTo($this->endpoint), $this->equalTo([ - 'timeout' => 60, + 'timeout' => 120, 'headers' => [ 'If-None-Match' => '"myETag"' ] @@ -522,6 +528,12 @@ public function testGetNoMatchingETag(): void { $this->config->method('getSystemValueBool') ->willReturnArgument(1); + $this->config->method('getAppValue') + ->willReturnMap([ + ['settings', 'appstore-fetcher-lastFailure', '0', '0'], + ['settings', 'appstore-timeout', '120', '120'], + ]); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -565,7 +577,7 @@ public function testGetNoMatchingETag(): void { ->with( $this->equalTo($this->endpoint), $this->equalTo([ - 'timeout' => 60, + 'timeout' => 120, 'headers' => [ 'If-None-Match' => '"myETag"', ] @@ -607,6 +619,12 @@ public function testFetchAfterUpgradeNoETag(): void { $this->config->method('getSystemValueBool') ->willReturnArgument(1); + $this->config->method('getAppValue') + ->willReturnMap([ + ['settings', 'appstore-fetcher-lastFailure', '0', '0'], + ['settings', 'appstore-timeout', '120', '120'], + ]); + $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $this->appData @@ -643,7 +661,7 @@ public function testFetchAfterUpgradeNoETag(): void { ->with( $this->equalTo($this->endpoint), $this->equalTo([ - 'timeout' => 60, + 'timeout' => 120, ]) ) ->willReturn($response);