From cae3417381222c527077be5330ef1b2222d31103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Rodr=C3=ADguez?= Date: Tue, 26 Sep 2017 19:40:04 -0300 Subject: Don't enforce gitaly request limits for distinct calls --- lib/gitlab/gitaly_client.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index 955d2307f88..3f10951f49e 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -165,7 +165,13 @@ module Gitlab return if permitted_call_count <= MAXIMUM_GITALY_CALLS - raise TooManyInvocationsError.new(call_site, actual_call_count, max_call_count, max_stacks) + # We've exceeded the limit, but we may still be in the presence of a non + # n+1 but still complex request with many distinct calls. If the maximum + # call count is 1 or less that's probably the case. + max_count = max_call_count + return if max_count <= 1 + + raise TooManyInvocationsError.new(call_site, actual_call_count, max_count, max_stacks) end def self.allow_n_plus_1_calls -- cgit v1.2.1