[artifact-repository-manager] RetryProvider: do not log retry limit exceeded exception as err, use warn instead

Otherwise, some tests behaviour may change by an error thrown from logger:
`com.intellij.testFramework.TestLoggerFactory$TestLoggerAssertionError: Retry attempts limit exceeded`

GitOrigin-RevId: c167353951d0d263bb5a457727eb6ba18999f204
This commit is contained in:
Vladislav.Yaroshchuk
2023-11-15 19:16:04 +04:00
committed by intellij-monorepo-bot
parent ee2be25e7a
commit 0e71c30b2e
2 changed files with 6 additions and 12 deletions

View File

@@ -85,7 +85,7 @@ public final class RetryProvider {
}
catch (Exception e) {
if (i == maxAttempts) {
logger.error("Retry attempts limit exceeded, tried " + maxAttempts + " times. Cause: " + e.getMessage(), e);
logger.warn("Retry attempts limit exceeded, tried " + maxAttempts + " times. Cause: " + e.getMessage(), e);
throw e;
}
logger.warn("Attempt " + i + " of " + maxAttempts + " failed, retrying in " + effectiveDelay + "ms. Cause: " + e.getMessage(), e);

View File

@@ -2,7 +2,6 @@
package org.jetbrains.idea.maven.aether;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.testFramework.LoggedErrorProcessor;
import org.junit.jupiter.api.Test;
import static org.jetbrains.idea.maven.aether.RetryProvider.disabled;
@@ -60,7 +59,7 @@ class RetryProviderTest {
@Test
public void expBackOff_testRetry() throws Exception {
int attempts = retryWithExpBackOff.retry(new ThrowingSupplier<Integer>() {
int attempts = retryWithExpBackOff.retry(new ThrowingSupplier<>() {
private int attempts = 0;
@Override
@@ -88,14 +87,9 @@ class RetryProviderTest {
@Test
public void expBackOff_testRethrowsException() {
Throwable error = LoggedErrorProcessor.executeAndReturnLoggedError(
() -> {
String expected = "Value42";
assertThrows(Exception.class, () -> retryWithExpBackOff.retry(() -> {
throw new Exception(expected);
}, logger), expected);
});
assertNotNull(error);
String expected = "Value42";
assertThrows(Exception.class, () -> retryWithExpBackOff.retry(() -> {
throw new Exception(expected);
}, logger), expected);
}
}