summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2017-09-25 11:22:07 +0100
committerAndrew Newdigate <andrew@gitlab.com>2017-09-25 11:22:07 +0100
commite4b69bc231c62814874ecff5ed85e9003ad6dddd (patch)
treea35333460cb4bfcb20949b5a090f2936c2cac58a
parent4d88f6496836c7fbf8a0f58e4d2604bf2c3f96d5 (diff)
downloadgitlab-ce-avatar_n_plus_one.tar.gz
Allow n+1s caused by avatar fetches on the project dashboard. See https://gitlab.com/gitlab-org/gitlab-ce/issues/38261avatar_n_plus_one
-rw-r--r--app/models/repository.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 90cede9d3d4..b28fe79e19c 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -534,8 +534,11 @@ class Repository
cache_method :tag_count, fallback: 0
def avatar
- if tree = file_on_head(:avatar)
- tree.path
+ # n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/38327
+ Gitlab::GitalyClient.allow_n_plus_1_calls do
+ if tree = file_on_head(:avatar)
+ tree.path
+ end
end
end
cache_method :avatar