Commit 6c15d7ea authored by Alex Kalderimis's avatar Alex Kalderimis

Minor reviewer suggestions

parent 4df22062
...@@ -27,8 +27,7 @@ class IssuePlacementWorker ...@@ -27,8 +27,7 @@ class IssuePlacementWorker
.limit(QUERY_LIMIT + 1) .limit(QUERY_LIMIT + 1)
.to_a .to_a
leftover = to_place.last if to_place.count > QUERY_LIMIT leftover = to_place.pop if to_place.count > QUERY_LIMIT
to_place = to_place.take(QUERY_LIMIT)
Issue.move_nulls_to_end(to_place) Issue.move_nulls_to_end(to_place)
Issues::BaseService.new(nil).rebalance_if_needed(to_place.max_by(&:relative_position)) Issues::BaseService.new(nil).rebalance_if_needed(to_place.max_by(&:relative_position))
......
...@@ -38,7 +38,7 @@ RSpec.describe IssuePlacementWorker do ...@@ -38,7 +38,7 @@ RSpec.describe IssuePlacementWorker do
end end
context 'there are more than QUERY_LIMIT unplaced issues' do context 'there are more than QUERY_LIMIT unplaced issues' do
let_it_be(:unplaced) do before_all do
# Ensure there are more than N issues in this set # Ensure there are more than N issues in this set
n = described_class::QUERY_LIMIT n = described_class::QUERY_LIMIT
create_list(:issue, n - 5, **unplaced) create_list(:issue, n - 5, **unplaced)
......
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