Skip to content

Commit

Permalink
Make PipelineIterator constructor depend just on strings
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Dec 20, 2023
1 parent 7d9c6bf commit 7ce9f5c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions server/src/main/java/org/elasticsearch/ingest/IngestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -776,12 +776,8 @@ private PipelineIterator getAndResetPipelines(IndexRequest indexRequest) {

final String pluginPipelineId = indexRequest.getPluginsPipeline();
indexRequest.setPluginsPipeline(NOOP_PIPELINE_NAME);
List<Pipeline> pluginsPipelines = null;
if (pluginPipelineId != null) {
pluginsPipelines = getPluginsPipelines(pluginPipelineId);
}

return new PipelineIterator(pipelineId, finalPipelineId, pluginsPipelines);
return new PipelineIterator(pipelineId, finalPipelineId, pluginPipelineId);
}

/**
Expand All @@ -801,14 +797,14 @@ private class PipelineIterator implements Iterator<PipelineSlot> {

private final String defaultPipeline;
private final String finalPipeline;
private final List<Pipeline> pluginsPipelines;
private final String pluginsPipelines;

private final Iterator<PipelineSlot> pipelineSlotIterator;

private PipelineIterator(String defaultPipeline, String finalPipeline, List<Pipeline> pluginsPipelines) {
private PipelineIterator(String defaultPipeline, String finalPipeline, String pluginsPipelines) {
this.defaultPipeline = NOOP_PIPELINE_NAME.equals(defaultPipeline) ? null : defaultPipeline;
this.finalPipeline = NOOP_PIPELINE_NAME.equals(finalPipeline) ? null : finalPipeline;
this.pluginsPipelines = pluginsPipelines;
this.pluginsPipelines = NOOP_PIPELINE_NAME.equals(pluginsPipelines) ? null : pluginsPipelines;
this.pipelineSlotIterator = iterator();
}

Expand All @@ -825,7 +821,9 @@ private Iterator<PipelineSlot> iterator() {
slotList.add(new PipelineSlot(finalPipeline, getPipeline(finalPipeline), true));
}
if (pluginsPipelines != null) {
slotList.addAll(pluginsPipelines.stream().map(pipeline -> new PipelineSlot("plugins", pipeline, false)).toList());
slotList.addAll(
getPluginsPipelines(pluginsPipelines).stream().map(pipeline -> new PipelineSlot("plugins", pipeline, false)).toList()
);
}
return slotList.iterator();
}
Expand Down

0 comments on commit 7ce9f5c

Please sign in to comment.