We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
__find_in_batches
1 parent 2b338c1 commit 8508577Copy full SHA for 8508577
elasticsearch-model/lib/elasticsearch/model/adapters/mongoid.rb
@@ -64,18 +64,8 @@ module Importing
64
#
65
def __find_in_batches(options={}, &block)
66
options[:batch_size] ||= 1_000
67
- items = []
68
-
69
- all.no_timeout.each do |item|
70
- items << item
71
72
- if items.length % options[:batch_size] == 0
73
- yield items
74
75
- end
76
77
78
- unless items.empty?
+
+ all.no_timeout.each_slice(options[:batch_size]) do |items|
79
yield items
80
end
81
0 commit comments