File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -44,16 +44,13 @@ public <T> List<WatchResponse> chunkedPush(
44
44
) {
45
45
List< WatchResponse> responses = new ArrayList<> ();
46
46
List< T> records = new ArrayList<> ();
47
- Int count = 0;
48
47
Int waitBatchSize = batchSize / 10;
49
48
if (waitBatchSize < 1) {
50
49
waitBatchSize = batchSize;
51
50
}
52
51
53
52
for (T item : objects) {
54
- if (records.size() == batchSize || count == objects.size() - 1) {
55
- count++;
56
-
53
+ if (records.size() == batchSize || ! item.hasNext()) {
57
54
WatchResponse watch =
58
55
this.push(
59
56
indexName,
@@ -68,7 +65,7 @@ public <T> List<WatchResponse> chunkedPush(
68
65
69
66
records.add(item);
70
67
71
- if (waitForTasks && (responses.size() % waitBatchSize == 0 || count == objects.size() - 1 )) {
68
+ if (waitForTasks && (responses.size() % waitBatchSize == 0 || !item.hasNext() )) {
72
69
responses.subList(Math.max(responses.size() - waitBatchSize, 0), responses.size()).forEach(response -> {
73
70
TaskUtils.retryUntil(
74
71
() -> {
You can’t perform that action at this time.
0 commit comments