Skip to content

Commit

Permalink
Fix clear scrol: pass scroll_id in body, as passing in path paramet…
Browse files Browse the repository at this point in the history
…ers is deprecated and can overflow `http.max_initial_line_length`
  • Loading branch information
Ivan Rabotyaga committed May 11, 2021
1 parent e19ad16 commit d9ffb6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/chewy/search/scrolling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def scroll_batches(batch_size: Request::DEFAULT_BATCH_SIZE, scroll: Request::DEF
result = perform_scroll(scroll: scroll, scroll_id: scroll_id)
end
ensure
Chewy.client.clear_scroll(scroll_id: scroll_id) if scroll_id
Chewy.client.clear_scroll(body: {scroll_id: scroll_id}) if scroll_id
end

# @!method scroll_hits(batch_size: 1000, scroll: '1m')
Expand Down
2 changes: 1 addition & 1 deletion spec/chewy/search/scrolling_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
end

it 'clears the scroll after completion' do
expect(Chewy.client).to receive(:clear_scroll).with(scroll_id: anything).once.and_call_original
expect(Chewy.client).to receive(:clear_scroll).with(body: {scroll_id: anything}).once.and_call_original
request.scroll_batches(batch_size: 3) {}
end

Expand Down

0 comments on commit d9ffb6e

Please sign in to comment.