-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved cloudwatch exporter retry functionality
the retry will now timeout before any configured lambda timeout period
- Loading branch information
Showing
7 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...substrate-aws-common/src/test/java/clusterless/cls/substrate/aws/sdk/ClientRetryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2023 Chris K Wensel <[email protected]>. All Rights Reserved. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package clusterless.cls.substrate.aws.sdk; | ||
|
||
import io.github.resilience4j.core.IntervalFunction; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.Duration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ClientRetryTest { | ||
@Test | ||
void max() { | ||
assertEquals(2, ClientRetry.maxAttempts(Duration.ofSeconds(60), IntervalFunction.of(Duration.ofSeconds(30)))); | ||
assertEquals(2, ClientRetry.maxAttempts(Duration.ofSeconds(60), IntervalFunction.ofExponentialBackoff(30000, 2, 600000))); | ||
|
||
IntervalFunction intervalFunction = IntervalFunction.ofExponentialBackoff(15000, 2, 600000); | ||
// System.out.println("IntStream.range(1,3).mapToLong(intervalFunction::apply).sum() = " + IntStream.range(1, 3).mapToLong(intervalFunction::apply).peek(System.out::println).sum()); | ||
assertEquals(3, ClientRetry.maxAttempts(Duration.ofSeconds(60), intervalFunction)); | ||
|
||
IntervalFunction intervalFunction1 = IntervalFunction.ofExponentialBackoff(Duration.ofSeconds(3), 2, Duration.ofMinutes(1)); | ||
// System.out.println("IntStream.range(1,19).mapToLong(intervalFunction::apply).sum() = " + IntStream.range(1, 19).mapToLong(intervalFunction1::apply).peek(System.out::println).sum()); | ||
// System.out.println("Duration.ofMinutes(15).toMillis() = " + Duration.ofMinutes(15).toMillis()); | ||
assertEquals(19, ClientRetry.maxAttempts(Duration.ofMinutes(15), intervalFunction1)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters