Skip to content

Commit 717d483

Browse files
committed
CR fixes
1 parent 0f9d2bd commit 717d483

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

server/src/main/java/org/elasticsearch/tasks/TaskManager.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public class TaskManager implements ClusterStateApplier {
8282

8383
private TaskResultsService taskResultsService;
8484

85-
private final String initialNodeId;
85+
// Used by tests that call register before setting the lastDiscoveryNodes.
86+
private final String nodeId;
8687
private DiscoveryNodes lastDiscoveryNodes = DiscoveryNodes.EMPTY_NODES;
8788

8889
private final Tracer tracer;
@@ -102,12 +103,12 @@ public TaskManager(Settings settings, ThreadPool threadPool, Set<String> taskHea
102103
this(settings, threadPool, taskHeaders, tracer, UUIDs.randomBase64UUID());
103104
}
104105

105-
public TaskManager(Settings settings, ThreadPool threadPool, Set<String> taskHeaders, Tracer tracer, @Nullable String initialNodeId) {
106+
public TaskManager(Settings settings, ThreadPool threadPool, Set<String> taskHeaders, Tracer tracer, @Nullable String nodeId) {
106107
this.threadPool = threadPool;
107108
this.taskHeaders = Set.copyOf(taskHeaders);
108109
this.maxHeaderSize = SETTING_HTTP_MAX_HEADER_SIZE.get(settings);
109110
this.tracer = tracer;
110-
this.initialNodeId = initialNodeId;
111+
this.nodeId = nodeId;
111112
}
112113

113114
public void setTaskResultsService(TaskResultsService taskResultsService) {
@@ -149,7 +150,7 @@ public Task register(String type, String action, TaskAwareRequest request, boole
149150
headers.put(key, httpHeader);
150151
}
151152
}
152-
String localNodeId = Optional.ofNullable(lastDiscoveryNodes.getLocalNodeId()).orElse(initialNodeId);
153+
String localNodeId = Optional.ofNullable(lastDiscoveryNodes.getLocalNodeId()).orElse(nodeId);
153154
Task task = request.createTask(
154155
new TaskId(localNodeId, taskIdGenerator.incrementAndGet()),
155156
type,

0 commit comments

Comments
 (0)