From 55a247e257939b720b24a447cf9ae53b475a9dd0 Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Mon, 20 Jan 2014 12:53:55 +0100 Subject: [PATCH] master_timeout parameter is now taken into account when calling cluster pending tasks api through the REST layer Closes #4806 --- rest-api-spec/api/cluster.pending_tasks.json | 4 ++++ .../admin/cluster/tasks/RestPendingClusterTasksAction.java | 1 + .../rest/action/cat/RestPendingClusterTasksAction.java | 1 + 3 files changed, 6 insertions(+) diff --git a/rest-api-spec/api/cluster.pending_tasks.json b/rest-api-spec/api/cluster.pending_tasks.json index 3b214c7b627..5ae1bdab66d 100644 --- a/rest-api-spec/api/cluster.pending_tasks.json +++ b/rest-api-spec/api/cluster.pending_tasks.json @@ -11,6 +11,10 @@ "local": { "type": "boolean", "description": "Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout": { + "type": "time", + "description": "Specify timeout for connection to master" } } }, diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java index efe525942b8..cfa010a5b8b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java @@ -44,6 +44,7 @@ public class RestPendingClusterTasksAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest(); + pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout())); pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local())); client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new ActionListener() { diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java index a4e163ddb7d..256e3ac544e 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -49,6 +49,7 @@ public class RestPendingClusterTasksAction extends AbstractCatAction { @Override public void doRequest(final RestRequest request, final RestChannel channel) { PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest(); + pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout())); pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local())); client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new ActionListener() { @Override