mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
Return false in hasUpdated when storage is not available
Technically, saying that a storage has no updates when it's not available is correct. This makes it possible to retrieve the cache entry for the mount point and also to list and remove unavailable federated shares. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
51317a8b92
commit
db29fd29ee
1 changed files with 10 additions and 4 deletions
|
|
@ -379,11 +379,15 @@ class Availability extends Wrapper {
|
|||
|
||||
/** {@inheritdoc} */
|
||||
public function hasUpdated($path, $time) {
|
||||
$this->checkAvailability();
|
||||
if (!$this->isAvailable()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return parent::hasUpdated($path, $time);
|
||||
} catch (StorageNotAvailableException $e) {
|
||||
$this->setUnavailable($e);
|
||||
// set unavailable but don't rethrow
|
||||
$this->setUnavailable(null);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -449,7 +453,7 @@ class Availability extends Wrapper {
|
|||
/**
|
||||
* @throws StorageNotAvailableException
|
||||
*/
|
||||
protected function setUnavailable(StorageNotAvailableException $e) {
|
||||
protected function setUnavailable(?StorageNotAvailableException $e) {
|
||||
$delay = self::RECHECK_TTL_SEC;
|
||||
if ($e instanceof StorageAuthException) {
|
||||
$delay = max(
|
||||
|
|
@ -459,7 +463,9 @@ class Availability extends Wrapper {
|
|||
);
|
||||
}
|
||||
$this->getStorageCache()->setAvailability(false, $delay);
|
||||
throw $e;
|
||||
if ($e !== null) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue