Remote TransportRethrottleAction from RestRethrottleAction
Just use the client to call it.
This commit is contained in:
parent
e359be7632
commit
d57b780bb4
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue