Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-07-18 01:23:20 +0300
committerStan Hu <stanhu@gmail.com>2019-07-18 01:23:20 +0300
commitddf2dcf7fdad69135cee590307773b255d2fe0b5 (patch)
tree3dcbcf1544393c892f8b80e679c06c0c0a1ca89f /lib/gitlab/gitaly_client.rb
parentb3b7d2c166a032ca11551e06664439d83f2caf59 (diff)
parent8765d537373679ccbb219ee400c277384972c742 (diff)
Merge branch 'jc-wrap-rugged-calls-with-disk-access' into 'master'
Wrap rugged calls with access disk block See merge request gitlab-org/gitlab-ce!30592
Diffstat (limited to 'lib/gitlab/gitaly_client.rb')
-rw-r--r--lib/gitlab/gitaly_client.rb25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb
index 0b6321c66ab..e7319a7b7f0 100644
--- a/lib/gitlab/gitaly_client.rb
+++ b/lib/gitlab/gitaly_client.rb
@@ -387,21 +387,20 @@ module Gitlab
end
def self.can_use_disk?(storage)
- false
- # cached_value = MUTEX.synchronize do
- # @can_use_disk ||= {}
- # @can_use_disk[storage]
- # end
+ cached_value = MUTEX.synchronize do
+ @can_use_disk ||= {}
+ @can_use_disk[storage]
+ end
- # return cached_value unless cached_value.nil?
+ return cached_value if cached_value.present?
- # gitaly_filesystem_id = filesystem_id(storage)
- # direct_filesystem_id = filesystem_id_from_disk(storage)
+ gitaly_filesystem_id = filesystem_id(storage)
+ direct_filesystem_id = filesystem_id_from_disk(storage)
- # MUTEX.synchronize do
- # @can_use_disk[storage] = gitaly_filesystem_id.present? &&
- # gitaly_filesystem_id == direct_filesystem_id
- # end
+ MUTEX.synchronize do
+ @can_use_disk[storage] = gitaly_filesystem_id.present? &&
+ gitaly_filesystem_id == direct_filesystem_id
+ end
end
def self.filesystem_id(storage)
@@ -414,7 +413,7 @@ module Gitlab
metadata_file = File.read(storage_metadata_file_path(storage))
metadata_hash = JSON.parse(metadata_file)
metadata_hash['gitaly_filesystem_id']
- rescue Errno::ENOENT, JSON::ParserError
+ rescue Errno::ENOENT, Errno::ACCESS, JSON::ParserError
nil
end