Skip to content

Commit 86ef778

Browse files
Merge pull request #55420 from nextcloud/fix/40082/appstore-timeout
2 parents 29832a3 + 3148170 commit 86ef778

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

lib/private/App/AppStore/Fetcher/Fetcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function fetch($ETag, $content, $allowUnstable = false) {
6969
}
7070

7171
$options = [
72-
'timeout' => 60,
72+
'timeout' => (int)$this->config->getAppValue('settings', 'appstore-timeout', '120')
7373
];
7474

7575
if ($ETag !== '') {

tests/lib/App/AppStore/Fetcher/AppFetcherTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ public function testGetAppsAllowlist(): void {
21332133
->expects($this->once())
21342134
->method('get')
21352135
->with('https://apps.nextcloud.com/api/v1/apps.json', [
2136-
'timeout' => 60,
2136+
'timeout' => 120,
21372137
'headers' => [
21382138
'X-NC-Subscription-Key' => 'subscription-key',
21392139
],
@@ -2191,6 +2191,12 @@ public function testGetAppsAllowlistCustomAppstore(): void {
21912191
->method('getSystemValueBool')
21922192
->willReturnArgument(1);
21932193

2194+
$this->config->method('getAppValue')
2195+
->willReturnMap([
2196+
['settings', 'appstore-fetcher-lastFailure', '0', '0'],
2197+
['settings', 'appstore-timeout', '120', '120'],
2198+
]);
2199+
21942200
$file = $this->createMock(ISimpleFile::class);
21952201
$folder = $this->createMock(ISimpleFolder::class);
21962202
$folder
@@ -2218,7 +2224,7 @@ public function testGetAppsAllowlistCustomAppstore(): void {
22182224
->expects($this->once())
22192225
->method('get')
22202226
->with('https://custom.appsstore.endpoint/api/v1/apps.json', [
2221-
'timeout' => 60,
2227+
'timeout' => 120,
22222228
])
22232229
->willReturn($response);
22242230
$response

tests/lib/App/AppStore/Fetcher/FetcherBase.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,12 @@ public function testGetMatchingETag(): void {
443443
$this->config->method('getSystemValueBool')
444444
->willReturnArgument(1);
445445

446+
$this->config->method('getAppValue')
447+
->willReturnMap([
448+
['settings', 'appstore-fetcher-lastFailure', '0', '0'],
449+
['settings', 'appstore-timeout', '120', '120'],
450+
]);
451+
446452
$folder = $this->createMock(ISimpleFolder::class);
447453
$file = $this->createMock(ISimpleFile::class);
448454
$this->appData
@@ -488,7 +494,7 @@ public function testGetMatchingETag(): void {
488494
->with(
489495
$this->equalTo($this->endpoint),
490496
$this->equalTo([
491-
'timeout' => 60,
497+
'timeout' => 120,
492498
'headers' => [
493499
'If-None-Match' => '"myETag"'
494500
]
@@ -522,6 +528,12 @@ public function testGetNoMatchingETag(): void {
522528
$this->config->method('getSystemValueBool')
523529
->willReturnArgument(1);
524530

531+
$this->config->method('getAppValue')
532+
->willReturnMap([
533+
['settings', 'appstore-fetcher-lastFailure', '0', '0'],
534+
['settings', 'appstore-timeout', '120', '120'],
535+
]);
536+
525537
$folder = $this->createMock(ISimpleFolder::class);
526538
$file = $this->createMock(ISimpleFile::class);
527539
$this->appData
@@ -565,7 +577,7 @@ public function testGetNoMatchingETag(): void {
565577
->with(
566578
$this->equalTo($this->endpoint),
567579
$this->equalTo([
568-
'timeout' => 60,
580+
'timeout' => 120,
569581
'headers' => [
570582
'If-None-Match' => '"myETag"',
571583
]
@@ -607,6 +619,12 @@ public function testFetchAfterUpgradeNoETag(): void {
607619
$this->config->method('getSystemValueBool')
608620
->willReturnArgument(1);
609621

622+
$this->config->method('getAppValue')
623+
->willReturnMap([
624+
['settings', 'appstore-fetcher-lastFailure', '0', '0'],
625+
['settings', 'appstore-timeout', '120', '120'],
626+
]);
627+
610628
$folder = $this->createMock(ISimpleFolder::class);
611629
$file = $this->createMock(ISimpleFile::class);
612630
$this->appData
@@ -643,7 +661,7 @@ public function testFetchAfterUpgradeNoETag(): void {
643661
->with(
644662
$this->equalTo($this->endpoint),
645663
$this->equalTo([
646-
'timeout' => 60,
664+
'timeout' => 120,
647665
])
648666
)
649667
->willReturn($response);

0 commit comments

Comments
 (0)