Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix flaky test ScheduledRetryingExecutorTest.testCancelOuterFutureAfterStart #3335

Merged
merged 4 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ void testCancelGetAttempt(boolean withCustomRetrySettings) throws Exception {
setUp(withCustomRetrySettings);
for (int executionsCount = 0; executionsCount < EXECUTIONS_COUNT; executionsCount++) {
ScheduledExecutorService localExecutor = Executors.newSingleThreadScheduledExecutor();
final int maxRetries = 100;
final int maxRetries = 20;

FailingCallable callable = new FailingCallable(maxRetries - 1, "request", "SUCCESS", tracer);
RetrySettings retrySettings =
FAST_RETRY_SETTINGS
.toBuilder()
.setTotalTimeoutDuration(java.time.Duration.ofMillis(1000L))
.setTotalTimeoutDuration(java.time.Duration.ofMillis(5000L))
.setMaxAttempts(maxRetries)
.build();

Expand Down Expand Up @@ -259,10 +259,11 @@ void testCancelOuterFutureAfterStart() throws Exception {
.toBuilder()
// These params were selected to ensure that future tries to run and fail (at least
// once) but does not complete before it is cancelled. Assuming no computation time,
// it would take 25 + 100 + 400 + 1000 = 1525ms for the future to complete, which should
// it would take 2500 + 10000 + 10000 + 10000 = 32500ms for the future to complete,
// which should
// be more than enough time to cancel the future.
.setInitialRetryDelayDuration(java.time.Duration.ofMillis(25L))
.setMaxRetryDelayDuration(java.time.Duration.ofMillis(1000L))
.setInitialRetryDelayDuration(java.time.Duration.ofMillis(2500L))
.setMaxRetryDelayDuration(java.time.Duration.ofMillis(10000L))
.setRetryDelayMultiplier(4.0)
.setTotalTimeoutDuration(java.time.Duration.ofMillis(60000L))
// Set this test to not use jitter as the randomized retry delay (RRD) may introduce
Expand Down
Loading