use OCP\ILogger;
abstract class Fetcher {
- public const INVALIDATE_AFTER_SECONDS = 300;
+ public const INVALIDATE_AFTER_SECONDS = 3600;
/** @var IAppData */
protected $appData;
// 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'];
}
$this->timeFactory
->expects($this->at(0))
->method('getTime')
- ->willReturn(1501);
+ ->willReturn(4801);
$client = $this->createMock(IClient::class);
$this->clientService
->expects($this->once())
$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())
$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')
$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')
$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 = [
[