Commit f4fe00e2 authored by Phil Hughes's avatar Phil Hughes

Fixed max batch size not working with pages

parent 3996bd75
...@@ -65,12 +65,12 @@ module Gitlab ...@@ -65,12 +65,12 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def load_paginated_collection(batch_page, batch_size, diff_options) def load_paginated_collection(batch_page, batch_size, diff_options)
batch_page ||= DEFAULT_BATCH_PAGE batch_page ||= DEFAULT_BATCH_PAGE
batch_size = [batch_size.to_i, DEFAULT_BATCH_SIZE].min batch_size ||= DEFAULT_BATCH_SIZE
paths = diff_options&.fetch(:paths, nil) paths = diff_options&.fetch(:paths, nil)
paginated_collection = if batch_gradual_load? paginated_collection = if batch_gradual_load?
relation.offset(batch_page).limit(batch_size) relation.offset(batch_page).limit([batch_size.to_i, DEFAULT_BATCH_SIZE].min)
else else
relation.page(batch_page).per(batch_size) relation.page(batch_page).per(batch_size)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment