Skip to content

Commit

Permalink
Fail cancelled CS requests without redundant wait for state update (#…
Browse files Browse the repository at this point in the history
…101905)

Just fail the request right away if it got cancelled.

Backports #96869 to 7.17 Closes #100671

Co-authored-by: Armin Braun <me@obrown.io>
  • Loading branch information
DaveCTurner and original-brownbear committed Nov 8, 2023
1 parent 8206af4 commit 4d7f289
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ protected void masterOperation(
? acceptableClusterStatePredicate
: acceptableClusterStatePredicate.or(clusterState -> clusterState.nodes().isLocalNodeElectedMaster() == false);

if (acceptableClusterStatePredicate.test(state) && cancellableTask.isCancelled() == false) {
if (cancellableTask.notifyIfCancelled(listener)) {
return;
}
if (acceptableClusterStatePredicate.test(state)) {
ActionListener.completeWith(listener, () -> buildResponse(request, state));
} else {
assert acceptableClusterStateOrFailedPredicate.test(state) == false;
Expand Down

0 comments on commit 4d7f289

Please sign in to comment.