Skip to content

Commit

Permalink
Fix possible flaky test for testBeforeIndexShardClosed_CancelsOngoing…
Browse files Browse the repository at this point in the history
…Replications() (#3963)

* Fixing flaky test failure happening for testShardAlreadyReplicating()

Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com>
  • Loading branch information
Rishikesh1159 authored Jul 21, 2022
1 parent 29adf2a commit 8b5a10c
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public void run() {

private void start(final long replicationId) {
try (ReplicationRef<SegmentReplicationTarget> replicationRef = onGoingReplications.get(replicationId)) {
// This check is for handling edge cases where the reference is removed before the ReplicationRunner is started by the
// threadpool.
if (replicationRef == null) {
return;
}
replicationRef.get().startReplication(new ActionListener<>() {
@Override
public void onResponse(Void o) {
Expand Down

0 comments on commit 8b5a10c

Please sign in to comment.