summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-06-05 13:57:22 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-06-05 13:57:22 +0200
commit21dbcf7e43bd8b00f58c5a328cd128b71c92c2dd (patch)
tree97aef2ec6b72dfa212e4646e8fc98090be57d810
parent093b47859a3bf4f7b9e8cee08368bd3ce2edfe3b (diff)
downloadgitlab-ce-bvl-nfs-circuitbreaker.tar.gz
Avoid 2 IO operations when FS is not respondingbvl-nfs-circuitbreaker
-rw-r--r--lib/gitlab/git/storage/circuit_breaker.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/gitlab/git/storage/circuit_breaker.rb b/lib/gitlab/git/storage/circuit_breaker.rb
index f2c52d696cb..fbcdd3aa6d0 100644
--- a/lib/gitlab/git/storage/circuit_breaker.rb
+++ b/lib/gitlab/git/storage/circuit_breaker.rb
@@ -46,9 +46,8 @@ module Gitlab
end
def storage_accessible?
- return false unless File.directory?(storage_path)
-
- Pathname.new(storage_path).realpath
+ realpath = Pathname.new(storage_path).realpath
+ File.directory?(realpath)
rescue Errno::EIO, Errno::ENOENT
false
end