Don't call ClusterService.state() in a ClusterStateUpdateTask

The current state is readily available as a parameter

Original commit: elastic/x-pack-elasticsearch@a09929aa82
This commit is contained in:
Yannick Welsch 2017-04-29 10:49:12 +02:00
parent e3834da05e
commit 308d5e0ae3
1 changed files with 1 additions and 1 deletions

View File

@ -57,7 +57,7 @@ public class PersistentTasksClusterService extends AbstractComponent implements
if (builder.hasTask(taskId)) { if (builder.hasTask(taskId)) {
throw new ResourceAlreadyExistsException("task with id {" + taskId + "} already exist"); throw new ResourceAlreadyExistsException("task with id {" + taskId + "} already exist");
} }
validate(action, clusterService.state(), params); validate(action, currentState, params);
final Assignment assignment; final Assignment assignment;
assignment = getAssignement(action, currentState, params); assignment = getAssignement(action, currentState, params);
return update(currentState, builder.addTask(taskId, action, params, assignment)); return update(currentState, builder.addTask(taskId, action, params, assignment));