Remote TransportRethrottleAction from RestRethrottleAction

Just use the client to call it.
This commit is contained in:
Nik Everett 2016-06-29 18:46:12 -04:00
parent e359be7632
commit d57b780bb4
1 changed files with 2 additions and 5 deletions

View File

@ -36,14 +36,11 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.action.admin.cluster.node.tasks.RestListTasksAction.nodeSettingListener; import static org.elasticsearch.rest.action.admin.cluster.node.tasks.RestListTasksAction.nodeSettingListener;
public class RestRethrottleAction extends BaseRestHandler { public class RestRethrottleAction extends BaseRestHandler {
private final TransportRethrottleAction action;
private final ClusterService clusterService; private final ClusterService clusterService;
@Inject @Inject
public RestRethrottleAction(Settings settings, RestController controller, Client client, TransportRethrottleAction action, public RestRethrottleAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
ClusterService clusterService) {
super(settings, client); super(settings, client);
this.action = action;
this.clusterService = clusterService; this.clusterService = clusterService;
controller.registerHandler(POST, "/_update_by_query/{taskId}/_rethrottle", this); controller.registerHandler(POST, "/_update_by_query/{taskId}/_rethrottle", this);
controller.registerHandler(POST, "/_delete_by_query/{taskId}/_rethrottle", this); controller.registerHandler(POST, "/_delete_by_query/{taskId}/_rethrottle", this);
@ -60,6 +57,6 @@ public class RestRethrottleAction extends BaseRestHandler {
} }
internalRequest.setRequestsPerSecond(requestsPerSecond); internalRequest.setRequestsPerSecond(requestsPerSecond);
ActionListener<ListTasksResponse> listener = nodeSettingListener(clusterService, new RestToXContentListener<>(channel)); ActionListener<ListTasksResponse> listener = nodeSettingListener(clusterService, new RestToXContentListener<>(channel));
action.execute(internalRequest, listener); client.execute(RethrottleAction.INSTANCE, internalRequest, listener);
} }
} }