diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb')
-rw-r--r-- | lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb b/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb index e8335a3c79c..bf9b73d918a 100644 --- a/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb +++ b/lib/gitlab/graphql/pagination/keyset/generic_keyset_pagination.rb @@ -73,9 +73,24 @@ module Gitlab strong_memoize(:generic_keyset_pagination_items) do rebuilt_items_with_keyset_order, success = Gitlab::Pagination::Keyset::SimpleOrderBuilder.build(original_items) - success ? rebuilt_items_with_keyset_order : original_items + if success + rebuilt_items_with_keyset_order + else + if original_items.is_a?(ActiveRecord::Relation) + old_keyset_pagination_usage.increment({ model: original_items.model.to_s }) + end + + original_items + end end end + + def old_keyset_pagination_usage + @old_keyset_pagination_usage ||= Gitlab::Metrics.counter( + :old_keyset_pagination_usage, + 'The number of times the old keyset pagination code was used' + ) + end end end end |