Skip to content

Commit

Permalink
Sonarqube fixes from subshard work coordination (#1151)
Browse files Browse the repository at this point in the history
* sonarqube fixes from subshard work coordination
* switch to sneaky throw for setupShardWorkItems

Signed-off-by: Mikayla Thompson <[email protected]>
  • Loading branch information
mikaylathompson authored Nov 20, 2024
1 parent 55a391f commit 1db3785
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ private static void retryWithExponentialBackoff(
Exception underlyingException = (Exception) e.getCause();
exceptionConsumer.accept(underlyingException);
throw new IllegalStateException(underlyingException);
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
attempt++;
if (attempt > maxRetries) {
exceptionConsumer.accept(e);
throw new RetriesExceededException(e, attempt);
}
Duration sleepDuration = Duration.ofMillis((long) (Math.pow(2.0, attempt - 1) * baseRetryTimeMs));
Duration sleepDuration = Duration.ofMillis((long) (Math.pow(2.0, attempt - 1.0) * baseRetryTimeMs));
log.atWarn().setCause(e)
.setMessage("Couldn't complete action due to exception. Backing off {} and trying again.")
.addArgument(sleepDuration).log();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ private void setupShardWorkItems(
Duration.ofMinutes(5),
context::createWorkAcquisitionContext
);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw Lombok.sneakyThrow(e);
} catch (Exception e) {
throw Lombok.sneakyThrow(e);
}
Expand Down

0 comments on commit 1db3785

Please sign in to comment.