mirror of
https://github.com/apache/druid.git
synced 2025-03-01 14:59:08 +00:00
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) {
|
if (currentTry > retryCount || callable.call() == expectedValue) {
|
||||||
break;
|
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) {
|
catch (Exception e) {
|
||||||
// just continue retrying if there is an exception (it may be transient!) but save the last:
|
// just continue retrying if there is an exception (it may be transient!) but save the last:
|
||||||
lastException = e;
|
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) {
|
if (currentTry > retryCount) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user