Skip to content

Commit c691b69

Browse files
committed
Use cleanupOnly listener instead
1 parent 7aa5332 commit c691b69

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

server/src/main/java/org/elasticsearch/indices/recovery/PeerRecoveryTargetService.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -310,21 +310,12 @@ private void doRecovery(final long recoveryId, final StartRecoveryRequest preExi
310310
indexShard.routingEntry().allocationId().getId(),
311311
recoveryTarget.clusterStateVersion()
312312
),
313-
new ActionListener<>() {
314-
@Override
315-
public void onResponse(ActionResponse.Empty empty) {
313+
cleanupOnly.delegateFailure((l, unused) -> {
314+
ActionListener.completeWith(l, () -> {
316315
onGoingRecoveries.markRecoveryAsDone(recoveryId);
317-
}
318-
319-
@Override
320-
public void onFailure(Exception e) {
321-
onGoingRecoveries.failRecovery(
322-
recoveryId,
323-
new RecoveryFailedException(recoveryState, "failed to recover unpromotable shard", e),
324-
true
325-
);
326-
}
327-
}
316+
return null;
317+
});
318+
})
328319
);
329320
}
330321
return;

0 commit comments

Comments
 (0)