From e4b69bc231c62814874ecff5ed85e9003ad6dddd Mon Sep 17 00:00:00 2001 From: Andrew Newdigate Date: Mon, 25 Sep 2017 11:22:07 +0100 Subject: [PATCH] Allow n+1s caused by avatar fetches on the project dashboard. See https://gitlab.com/gitlab-org/gitlab-ce/issues/38261 --- app/models/repository.rb | 7 +++++-- 1 file 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