mirror of https://github.com/apache/druid.git
Fix retry sleep when callable throws exception (#11430)
If the callable throws an exception, we neither increase the retry count nor sleep the thread.
This commit is contained in:
parent
377b5e708c
commit
e228a84d91
|
@ -61,17 +61,23 @@ public class ITRetryUtil
|
|||
if (currentTry > retryCount || callable.call() == expectedValue) {
|
||||
break;
|
||||
}
|
||||
LOG.info(
|
||||
"Attempt[%d/%d] did not pass: Task %s still not complete. Next retry in %d ms",
|
||||
currentTry, retryCount, taskMessage, delayInMillis
|
||||
);
|
||||
Thread.sleep(delayInMillis);
|
||||
currentTry++;
|
||||
}
|
||||
catch (Exception e) {
|
||||
// just continue retrying if there is an exception (it may be transient!) but save the last:
|
||||
lastException = e;
|
||||
}
|
||||
|
||||
LOG.info(
|
||||
"Attempt[%d/%d] did not pass: Task %s still not complete. Next retry in %d ms",
|
||||
currentTry, retryCount, taskMessage, delayInMillis
|
||||
);
|
||||
try {
|
||||
Thread.sleep(delayInMillis);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
// Ignore
|
||||
}
|
||||
currentTry++;
|
||||
}
|
||||
|
||||
if (currentTry > retryCount) {
|
||||
|
|
Loading…
Reference in New Issue