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/git
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/git')
-rw-r--r--lib/gitlab/git/rugged_impl/blob.rb2
-rw-r--r--lib/gitlab/git/rugged_impl/commit.rb6
-rw-r--r--lib/gitlab/git/rugged_impl/repository.rb2
-rw-r--r--lib/gitlab/git/rugged_impl/tree.rb2
-rw-r--r--lib/gitlab/git/rugged_impl/use_rugged.rb6
5 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab/git/rugged_impl/blob.rb b/lib/gitlab/git/rugged_impl/blob.rb
index 86c9f33d82a..9aea736527b 100644
--- a/lib/gitlab/git/rugged_impl/blob.rb
+++ b/lib/gitlab/git/rugged_impl/blob.rb
@@ -16,7 +16,7 @@ module Gitlab
override :tree_entry
def tree_entry(repository, sha, path, limit)
if use_rugged?(repository, :rugged_tree_entry)
- rugged_tree_entry(repository, sha, path, limit)
+ wrap_rugged_call { rugged_tree_entry(repository, sha, path, limit) }
else
super
end
diff --git a/lib/gitlab/git/rugged_impl/commit.rb b/lib/gitlab/git/rugged_impl/commit.rb
index 971a33b2e99..29ae9bdd851 100644
--- a/lib/gitlab/git/rugged_impl/commit.rb
+++ b/lib/gitlab/git/rugged_impl/commit.rb
@@ -36,7 +36,7 @@ module Gitlab
override :find_commit
def find_commit(repo, commit_id)
if use_rugged?(repo, :rugged_find_commit)
- rugged_find(repo, commit_id)
+ wrap_rugged_call { rugged_find(repo, commit_id) }
else
super
end
@@ -45,7 +45,7 @@ module Gitlab
override :batch_by_oid
def batch_by_oid(repo, oids)
if use_rugged?(repo, :rugged_list_commits_by_oid)
- rugged_batch_by_oid(repo, oids)
+ wrap_rugged_call { rugged_batch_by_oid(repo, oids) }
else
super
end
@@ -68,7 +68,7 @@ module Gitlab
override :commit_tree_entry
def commit_tree_entry(path)
if use_rugged?(@repository, :rugged_commit_tree_entry)
- rugged_tree_entry(path)
+ wrap_rugged_call { rugged_tree_entry(path) }
else
super
end
diff --git a/lib/gitlab/git/rugged_impl/repository.rb b/lib/gitlab/git/rugged_impl/repository.rb
index 9268abdfed9..7bed553393c 100644
--- a/lib/gitlab/git/rugged_impl/repository.rb
+++ b/lib/gitlab/git/rugged_impl/repository.rb
@@ -48,7 +48,7 @@ module Gitlab
override :ancestor?
def ancestor?(from, to)
if use_rugged?(self, :rugged_commit_is_ancestor)
- rugged_is_ancestor?(from, to)
+ wrap_rugged_call { rugged_is_ancestor?(from, to) }
else
super
end
diff --git a/lib/gitlab/git/rugged_impl/tree.rb b/lib/gitlab/git/rugged_impl/tree.rb
index f3721a3f1b7..479c5f9d8b7 100644
--- a/lib/gitlab/git/rugged_impl/tree.rb
+++ b/lib/gitlab/git/rugged_impl/tree.rb
@@ -16,7 +16,7 @@ module Gitlab
override :tree_entries
def tree_entries(repository, sha, path, recursive)
if use_rugged?(repository, :rugged_tree_entries)
- tree_entries_with_flat_path_from_rugged(repository, sha, path, recursive)
+ wrap_rugged_call { tree_entries_with_flat_path_from_rugged(repository, sha, path, recursive) }
else
super
end
diff --git a/lib/gitlab/git/rugged_impl/use_rugged.rb b/lib/gitlab/git/rugged_impl/use_rugged.rb
index 99091b03cd1..902fa3c7822 100644
--- a/lib/gitlab/git/rugged_impl/use_rugged.rb
+++ b/lib/gitlab/git/rugged_impl/use_rugged.rb
@@ -10,6 +10,12 @@ module Gitlab
Gitlab::GitalyClient.can_use_disk?(repo.storage)
end
+
+ def wrap_rugged_call(&block)
+ Gitlab::GitalyClient::StorageSettings.allow_disk_access do
+ yield
+ end
+ end
end
end
end