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:
Diffstat (limited to 'lib/gitlab/graphql/limit/field_call_count.rb')
-rw-r--r--lib/gitlab/graphql/limit/field_call_count.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/gitlab/graphql/limit/field_call_count.rb b/lib/gitlab/graphql/limit/field_call_count.rb
index 4165970a2a6..3a02e8abbb5 100644
--- a/lib/gitlab/graphql/limit/field_call_count.rb
+++ b/lib/gitlab/graphql/limit/field_call_count.rb
@@ -14,9 +14,18 @@ module Gitlab
private
def increment_call_count(context)
+ query_id = fetch_query_id(context)
+
context[:call_count] ||= {}
- context[:call_count][field] ||= 0
- context[:call_count][field] += 1
+ context[:call_count][query_id] ||= {}
+ context[:call_count][query_id][field] ||= 0
+ context[:call_count][query_id][field] += 1
+ end
+
+ def fetch_query_id(context)
+ context.query.operation_fingerprint
+ rescue TypeError
+ ''
end
def limit