You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by ab...@apache.org on 2021/07/11 09:36:33 UTC

[druid] branch master updated: Fix retry sleep when callable throws exception (#11430)

This is an automated email from the ASF dual-hosted git repository.

abhishek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new e228a84  Fix retry sleep when callable throws exception (#11430)
e228a84 is described below

commit e228a84d9178cad085497b2aa6e89d246bcf0b36
Author: Abhishek Agarwal <14...@users.noreply.github.com>
AuthorDate: Sun Jul 11 15:06:10 2021 +0530

    Fix retry sleep when callable throws exception (#11430)
    
    If the callable throws an exception, we neither increase the retry count nor sleep the thread.
---
 .../org/apache/druid/testing/utils/ITRetryUtil.java    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/integration-tests/src/main/java/org/apache/druid/testing/utils/ITRetryUtil.java b/integration-tests/src/main/java/org/apache/druid/testing/utils/ITRetryUtil.java
index e43c26d..a306d81 100644
--- a/integration-tests/src/main/java/org/apache/druid/testing/utils/ITRetryUtil.java
+++ b/integration-tests/src/main/java/org/apache/druid/testing/utils/ITRetryUtil.java
@@ -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) {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org