Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
e59ccc5f
Commit
e59ccc5f
authored
Apr 29, 2016
by
Thomas Müller
Browse files
Merge pull request #24299 from owncloud/availability-avoid-concurrency
Prevent concurrent storage availability checks
parents
f79a8125
77cec29b
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/private/Files/Storage/Wrapper/Availability.php
View file @
e59ccc5f
...
...
@@ -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
)
{
...
...
tests/lib/files/storage/wrapper/availability.php
View file @
e59ccc5f
...
...
@@ -74,9 +74,12 @@ class Availability extends \Test\TestCase {
$storage
->
expects
(
$this
->
once
())
->
method
(
'test'
)
->
willReturn
(
true
);
$storage
->
expects
(
$this
->
once
(
))
$storage
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'setAvailability'
)
->
with
(
$this
->
equalTo
(
true
));
->
withConsecutive
(
[
$this
->
equalTo
(
false
)],
// prevents concurrent rechecks
[
$this
->
equalTo
(
true
)]
// sets correct availability
);
$storage
->
expects
(
$this
->
once
())
->
method
(
'mkdir'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment