Instead we should use `org.elasticsearch.tasks.CancellableTask#addListener` to add a listener which sets `failure` on cancellation.
x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/RepositoryAnalyzeAction.java
if (currentValue > request.getConcurrency() && otherAnalysisComplete.get()) {
                    return;
                }
                transportService.sendChildRequest(
                    nodes.get(currentValue < nodes.size() ? currentValue : random.nextInt(nodes.size())),
                    UncontendedRegisterAnalyzeAction.NAME,
                    new UncontendedRegisterAnalyzeAction.Request(request.getRepositoryName(), blobPath, registerName, currentValue),
                    task,
                    TransportRequestOptions.EMPTY,
                    new ActionListenerResponseHandler<>(
                        ActionListener.releaseAfter(stepListener, requestRefs.acquire()),
                        in -> ActionResponse.Empty.INSTANCE,
                        TransportResponseHandler.TRANSPORT_WORKER
                    )
                );
            }
        }
        private void runCleanUp() {
            transportService.getThreadPool().executor(ThreadPool.Names.SNAPSHOT).execute(ActionRunnable.wrap(listener, l -> {
                final long listingStartTimeNanos = System.nanoTime();
                ensureConsistentListing();
                final long deleteStartTimeNanos = System.nanoTime();
                deleteContainer();
                sendResponse(listingStartTimeNanos, deleteStartTimeNanos);
            }));
        }
        private void ensureConsistentListing() {
            if (timeoutTimeMillis < currentTimeMillisSupplier.getAsLong() || task.isCancelled()) {
                logger.warn(
                    "analysis of repository [{}] failed before cleanup phase, attempting best-effort cleanup "