Ma77Ball commented on code in PR #5647:
URL: https://github.com/apache/texera/pull/5647#discussion_r3408897780


##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/LakeFSStorageClient.scala:
##########
@@ -69,11 +74,30 @@ object LakeFSStorageClient {
   private val branchName: String = "main"
 
   def healthCheck(): Unit = {
-    try {
-      this.healthCheckApi.healthCheck().execute()
-    } catch {
-      case e: Exception =>
-        throw new RuntimeException(s"Failed to connect to lake fs server: 
${e.getMessage}")
+    var attempt = 1
+    while (true) {
+      try {
+        this.healthCheckApi.healthCheck().execute()
+        return
+      } catch {
+        case ie: InterruptedException =>
+          // Restore the interrupt status and fail fast rather than retrying.
+          Thread.currentThread().interrupt()
+          throw new RuntimeException("Interrupted while waiting to retry lake 
fs health check", ie)
+        case e: Exception =>
+          if (attempt >= HealthCheckMaxAttempts) {
+            throw new RuntimeException(
+              s"Failed to connect to lake fs server after 
$HealthCheckMaxAttempts attempts: ${e.getMessage}",
+              e
+            )
+          }
+          logger.warn(
+            s"LakeFS not reachable (attempt $attempt/$HealthCheckMaxAttempts): 
${e.getMessage}. " +
+              s"Retrying in ${HealthCheckRetryDelayMillis}ms..."
+          )
+          Thread.sleep(HealthCheckRetryDelayMillis)

Review Comment:
   Switched to exponential backoff starting at 200ms (200 → 400 → 800 → 1600ms) 
over 5 attempts, capping total wait at ~3s instead of ~30s. The doubling logic 
lives in the new `retryWithBackoff` helper.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to