diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-05-19 23:04:25 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-05-20 11:18:19 +0200 |
commit | f7b39e13a2890212e277444a1dc8484838888fd4 (patch) | |
tree | a7e9fa68bde59cc84348c965e4abcd8aed1e868c | |
parent | d6fa810331ec967bb619e9d4ed89451003470b06 (diff) | |
download | nextcloud-server-f7b39e13a2890212e277444a1dc8484838888fd4.tar.gz nextcloud-server-f7b39e13a2890212e277444a1dc8484838888fd4.zip |
Cache appstore requests for 60 instead of 5 minutes
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 4 | ||||
-rw-r--r-- | tests/lib/App/AppStore/Fetcher/FetcherBase.php | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index 224ed7d1f0d..d6c882cf7de 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -40,7 +40,7 @@ use OCP\ILogger; use OCP\Util; abstract class Fetcher { - const INVALIDATE_AFTER_SECONDS = 300; + const INVALIDATE_AFTER_SECONDS = 3600; /** @var IAppData */ protected $appData; @@ -152,7 +152,7 @@ abstract class Fetcher { // No caching when the version has been updated if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->getVersion()) { - // If the timestamp is older than 300 seconds request the files new + // If the timestamp is older than 3600 seconds request the files new if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) { return $jsonBlob['data']; } diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php index 9dac4dd7499..758d917fac4 100644 --- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php +++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php @@ -239,7 +239,7 @@ abstract class FetcherBase extends TestCase { $this->timeFactory ->expects($this->at(0)) ->method('getTime') - ->willReturn(1501); + ->willReturn(4801); $client = $this->createMock(IClient::class); $this->clientService ->expects($this->once()) @@ -533,11 +533,11 @@ abstract class FetcherBase extends TestCase { $this->timeFactory ->expects($this->at(0)) ->method('getTime') - ->willReturn(1501); + ->willReturn(4801); $this->timeFactory ->expects($this->at(1)) ->method('getTime') - ->willReturn(1502); + ->willReturn(4802); $client = $this->createMock(IClient::class); $this->clientService ->expects($this->once()) @@ -559,7 +559,7 @@ abstract class FetcherBase extends TestCase { $response->method('getStatusCode') ->willReturn(304); - $newData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502,"ncversion":"11.0.0.2","ETag":"\"myETag\""}'; + $newData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":4802,"ncversion":"11.0.0.2","ETag":"\"myETag\""}'; $file ->expects($this->at(1)) ->method('putContent') @@ -638,7 +638,7 @@ abstract class FetcherBase extends TestCase { $response->method('getHeader') ->with($this->equalTo('ETag')) ->willReturn('"newETag"'); - $fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502,"ncversion":"11.0.0.2","ETag":"\"newETag\""}'; + $fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":4802,"ncversion":"11.0.0.2","ETag":"\"newETag\""}'; $file ->expects($this->at(1)) ->method('putContent') @@ -650,11 +650,11 @@ abstract class FetcherBase extends TestCase { $this->timeFactory ->expects($this->at(0)) ->method('getTime') - ->willReturn(1501); + ->willReturn(4801); $this->timeFactory ->expects($this->at(1)) ->method('getTime') - ->willReturn(1502); + ->willReturn(4802); $expected = [ [ |