diff options
Diffstat (limited to 'lib/gitlab/pagination/offset_pagination.rb')
-rw-r--r-- | lib/gitlab/pagination/offset_pagination.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/pagination/offset_pagination.rb b/lib/gitlab/pagination/offset_pagination.rb index 4f8a6ffb2cc..7b5013f137b 100644 --- a/lib/gitlab/pagination/offset_pagination.rb +++ b/lib/gitlab/pagination/offset_pagination.rb @@ -29,7 +29,7 @@ module Gitlab return pagination_data unless Feature.enabled?(:api_kaminari_count_with_limit, type: :ops) limited_total_count = pagination_data.total_count_with_limit - if limited_total_count > Kaminari::ActiveRecordRelationMethods::MAX_COUNT_LIMIT + if limited_total_count > max_limit # The call to `total_count_with_limit` memoizes `@arel` because of a call to `references_eager_loaded_tables?` # We need to call `reset` because `without_count` relies on `@arel` being unmemoized pagination_data.reset.without_count @@ -38,6 +38,14 @@ module Gitlab end end + def max_limit + if Feature.enabled?(:lower_relation_max_count_limit, type: :ops) + Kaminari::ActiveRecordRelationMethods::MAX_COUNT_NEW_LOWER_LIMIT + else + Kaminari::ActiveRecordRelationMethods::MAX_COUNT_LIMIT + end + end + def needs_pagination?(relation) return true unless relation.respond_to?(:current_page) return true if params[:page].present? && relation.current_page != params[:page].to_i |