bail out of recovery when close and still waiting on throttling

This commit is contained in:
kimchy 2010-08-20 01:24:02 +03:00
parent a05c367c5e
commit acae0650c8
1 changed files with 7 additions and 2 deletions

View File

@ -150,6 +150,10 @@ public class IndexShardGatewayService extends AbstractIndexShardComponent implem
// we know we are on a thread, we can spin till we can engage in recovery
while (!recoveryThrottler.tryRecovery(shardId, "gateway")) {
if (indexShard.ignoreRecoveryAttempt()) {
listener.onIgnoreRecovery("ignoring recovery while waiting on retry");
return;
}
recoveryStatus.updateStage(RecoveryStatus.Stage.RETRY);
try {
Thread.sleep(recoveryThrottler.throttleInterval().millis());
@ -157,9 +161,10 @@ public class IndexShardGatewayService extends AbstractIndexShardComponent implem
} catch (InterruptedException e) {
if (indexShard.ignoreRecoveryAttempt()) {
listener.onIgnoreRecovery("Interrupted while waiting for recovery, but we should ignore ...");
return;
} else {
listener.onRecoveryFailed(new IndexShardGatewayRecoveryException(shardId, "Interrupted while waiting to recovery", e));
}
listener.onRecoveryFailed(new IndexShardGatewayRecoveryException(shardId, "Interrupted while waiting to recovery", e));
return;
}
}