Compare commits

...

1 Commits

Author SHA1 Message Date
Robin Appelman
e1765cdef2 fix: make failed availability check apply in the same request
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-11-12 16:35:05 +01:00

View File

@@ -22,6 +22,7 @@ class Availability extends Wrapper {
/** @var IConfig */
protected $config;
protected ?bool $available = null;
public function __construct(array $parameters) {
$this->config = $parameters['config'] ?? \OCP\Server::get(IConfig::class);
@@ -54,11 +55,14 @@ class Availability extends Wrapper {
}
private function isAvailable(): bool {
$availability = $this->getAvailability();
if (self::shouldRecheck($availability)) {
return $this->updateAvailability();
if (is_null($this->available)) {
$availability = $this->getAvailability();
if (self::shouldRecheck($availability)) {
return $this->updateAvailability();
}
$this->available = $availability['available'];
}
return $availability['available'];
return $this->available;
}
/**
@@ -257,6 +261,7 @@ class Availability extends Wrapper {
self::RECHECK_TTL_SEC
);
}
$this->available = false;
$this->getStorageCache()->setAvailability(false, $delay);
if ($e !== null) {
throw $e;