From 77cec29b108df7d9c868d60baf74fbe9b64e08f5 Mon Sep 17 00:00:00 2001
From: Robin McCorkell <robin@mccorkell.me.uk>
Date: Tue, 26 Apr 2016 22:30:09 +0100
Subject: Prevent concurrent availability checks

---
 lib/private/Files/Storage/Wrapper/Availability.php | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'lib')

diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php
index 0ed31ba854a..8d6fc4b3369 100644
--- a/lib/private/Files/Storage/Wrapper/Availability.php
+++ b/lib/private/Files/Storage/Wrapper/Availability.php
@@ -40,9 +40,13 @@ class Availability extends Wrapper {
 	}
 
 	/**
+	 * Only called if availability === false
+	 *
 	 * @return bool
 	 */
 	private function updateAvailability() {
+		// reset availability to false so that multiple requests don't recheck concurrently
+		$this->setAvailability(false);
 		try {
 			$result = $this->test();
 		} catch (\Exception $e) {
-- 
cgit v1.2.3