Skip to content

Commit ec2194f

Browse files
committed
move checking error down
1 parent 97b2099 commit ec2194f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,6 @@ protected void doRun() throws Exception {
727727
while (true) {
728728
assert semaphore.availablePermits() == 0;
729729
cancellableThreads.checkForCancel();
730-
if (error.get() != null) {
731-
handleErrorOnSendFiles(store, error.get().v2(), new StoreFileMetaData[]{error.get().v1()});
732-
throw error.get().v2();
733-
}
734730
if (canSendMore() == false) {
735731
semaphore.release();
736732
// Here we have to retry before abort to avoid a race situation where the other threads have flipped `canSendMore`
@@ -740,6 +736,10 @@ protected void doRun() throws Exception {
740736
break;
741737
}
742738
}
739+
if (error.get() != null) {
740+
handleErrorOnSendFiles(store, error.get().v2(), new StoreFileMetaData[]{error.get().v1()});
741+
throw error.get().v2();
742+
}
743743
final FileChunk chunk = readNextChunk();
744744
if (chunk == null) {
745745
semaphore.release(); // allow other threads respond if we are not done yet.

0 commit comments

Comments
 (0)