Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Brooks committed Oct 5, 2024
1 parent 659bde5 commit ece8f6b
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC

static class ChunkHandler implements BaseRestHandler.RequestBodyChunkConsumer {

private final boolean allowExplicitIndex;
private final RestRequest request;

private final BulkRequestParser.IncrementalParser parser;
private final Supplier<IncrementalBulkService.Handler> handlerSupplier;
private BulkRequestParser.IncrementalParser parser;
private IncrementalBulkService.Handler handler;

private volatile RestChannel restChannel;
Expand All @@ -150,7 +151,15 @@ static class ChunkHandler implements BaseRestHandler.RequestBodyChunkConsumer {
private final ArrayList<DocWriteRequest<?>> items = new ArrayList<>(4);

ChunkHandler(boolean allowExplicitIndex, RestRequest request, Supplier<IncrementalBulkService.Handler> handlerSupplier) {
this.allowExplicitIndex = allowExplicitIndex;
this.request = request;
this.handlerSupplier = handlerSupplier;
}

@Override
public void accept(RestChannel restChannel) {
this.restChannel = restChannel;
this.handler = handlerSupplier.get();
this.parser = new BulkRequestParser(true, request.getRestApiVersion(), handler::loadRequestContext).incrementalParser(
request.param("index"),
request.param("routing"),
Expand All @@ -165,13 +174,6 @@ static class ChunkHandler implements BaseRestHandler.RequestBodyChunkConsumer {
items::add,
items::add
);
this.handlerSupplier = handlerSupplier;
}

@Override
public void accept(RestChannel restChannel) {
this.restChannel = restChannel;
this.handler = handlerSupplier.get();
request.contentStream().next();
}

Expand Down

0 comments on commit ece8f6b

Please sign in to comment.