Skip to content

Commit

Permalink
timeout can be null if upgraded from 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrik Muhs committed Sep 27, 2023
1 parent 191f65f commit e97338e
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 @@ -138,7 +139,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()));
Expand Down

0 comments on commit e97338e

Please sign in to comment.