Skip to content

Commit

Permalink
timeout could be null
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrik Muhs committed Sep 27, 2023
1 parent e5ad964 commit 92929ef
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.action.FailedNodeException;
import org.elasticsearch.action.TaskOperationFailure;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.action.support.tasks.BaseTasksResponse;
import org.elasticsearch.action.support.tasks.TransportTasksAction;
import org.elasticsearch.client.internal.Client;
Expand Down Expand Up @@ -140,7 +141,11 @@ protected void taskOperation(CancellableTask actionTask, Request request, Transf
),
// at this point the transport already spend some time budget in `doExecute`, it is hard to tell what is left:
// recording the time spend would be complex and crosses machine boundaries, that's why we use a heuristic here
TimeValue.timeValueMillis((long) (request.getTimeout().millis() * CHECKPOINT_INFO_TIMEOUT_SHARE))
TimeValue.timeValueMillis(
(long) ((request.getTimeout() != null
? request.getTimeout().millis()
: AcknowledgedRequest.DEFAULT_ACK_TIMEOUT.millis()) * CHECKPOINT_INFO_TIMEOUT_SHARE)
)
);
} else {
listener.onResponse(new Response(Collections.emptyList(), 0L));
Expand Down

0 comments on commit 92929ef

Please sign in to comment.