Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -437,22 +437,10 @@ private void fail(Exception e) {
}

/**
* Check that we haven't already failed or been cancelled or timed out; if newly cancelled or timed out then record this as the root
* cause of failure.
* Check that we haven't already failed (including cancellation and timing out).
*/
private boolean isRunning() {
if (failure.get() != null) {
return false;
}

if (task.isCancelled()) {
setFirstFailure(new RepositoryVerificationException(request.repositoryName, "verification cancelled"));
// if this CAS failed then we're failing for some other reason, nbd; also if the task is cancelled then its descendants are
// also cancelled, so no further action is needed either way.
return false;
}

return true;
return failure.get() == null;
}

private class CheckForCancelListener implements ActionListener<Void> {
Expand Down Expand Up @@ -485,6 +473,8 @@ public void run() {
cancellationListener.addTimeout(request.getTimeout(), repository.threadPool(), EsExecutors.DIRECT_EXECUTOR_SERVICE);
cancellationListener.addListener(new CheckForCancelListener());

task.addListener(() -> setFirstFailure(new RepositoryVerificationException(request.repositoryName, "analysis cancelled")));

final Random random = new Random(request.getSeed());
final List<DiscoveryNode> nodes = getSnapshotNodes(discoveryNodes);

Expand Down