summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorC. Montero Luque <cmonteroluque@users.noreply.github.com>2016-03-04 13:35:04 -0500
committerC. Montero Luque <cmonteroluque@users.noreply.github.com>2016-03-04 13:35:04 -0500
commit7a0720f30061bdf948d9eae15e4872c927792bfb (patch)
treed59c149efeb84b4f46fbaffb1f80b0e5e53899e9 /lib
parent138219d74a2a98f9fcc3e875658c3b6c259340d9 (diff)
parent45f49a090aea50b29a9162717ce38799cd0c7111 (diff)
downloadnextcloud-server-7a0720f30061bdf948d9eae15e4872c927792bfb.tar.gz
nextcloud-server-7a0720f30061bdf948d9eae15e4872c927792bfb.zip
Merge branch 'master' into fix-db-locking-cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/wrapper/availability.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/private/files/storage/wrapper/availability.php b/lib/private/files/storage/wrapper/availability.php
index 55ddb0d5e8f..0ed31ba854a 100644
--- a/lib/private/files/storage/wrapper/availability.php
+++ b/lib/private/files/storage/wrapper/availability.php
@@ -29,6 +29,16 @@ namespace OC\Files\Storage\Wrapper;
class Availability extends Wrapper {
const RECHECK_TTL_SEC = 600; // 10 minutes
+ public static function shouldRecheck($availability) {
+ if (!$availability['available']) {
+ // trigger a recheck if TTL reached
+ if ((time() - $availability['last_checked']) > self::RECHECK_TTL_SEC) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* @return bool
*/
@@ -47,11 +57,8 @@ class Availability extends Wrapper {
*/
private function isAvailable() {
$availability = $this->getAvailability();
- if (!$availability['available']) {
- // trigger a recheck if TTL reached
- if ((time() - $availability['last_checked']) > self::RECHECK_TTL_SEC) {
- return $this->updateAvailability();
- }
+ if (self::shouldRecheck($availability)) {
+ return $this->updateAvailability();
}
return $availability['available'];
}