Skip to content

Commit 877bff8

Browse files
authored
Lowering ack callback to avoid race condition (#6012)
* Lowering ack callback to avoid race condition * Lowering ack callback to avoid race condition * Adding retryable annotation --------- Co-authored-by: Ran Vaknin <[email protected]>
1 parent 80b1c08 commit 877bff8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/internal/http2/Http2PingHandlerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import software.amazon.awssdk.http.Protocol;
4545
import software.amazon.awssdk.http.nio.netty.internal.ChannelAttributeKey;
4646
import software.amazon.awssdk.http.nio.netty.internal.utils.NettyClientLogger;
47+
import software.amazon.awssdk.testutils.retry.RetryableTest;
4748

4849
public class Http2PingHandlerTest {
4950
private static final NettyClientLogger log = NettyClientLogger.getLogger(Http2PingHandler.class);
@@ -227,7 +228,7 @@ public void channelInactive_shouldCancelTaskAndForwardToOtherHandlers() {
227228
assertThat(channel.runScheduledPendingTasks()).isEqualTo(-1L);
228229
}
229230

230-
@Test
231+
@RetryableTest(maxRetries = 3)
231232
public void delayedPingFlushDoesntTerminateConnectionPrematurely() {
232233
Logger.getLogger("").setLevel(Level.ALL);
233234

@@ -238,7 +239,7 @@ public void delayedPingFlushDoesntTerminateConnectionPrematurely() {
238239
EmbeddedChannel channel = createHttp2Channel(fastChecker, catcher, pingResponder, delayingWriter);
239240

240241
pingResponder.setCallback(() -> channel.writeInbound(new DefaultHttp2PingFrame(0, true)),
241-
FAST_CHECKER_DURATION_MILLIS / 10 /* send ack in 10 ms after getting ping*/);
242+
5 /* send ack in 5 ms after getting ping*/);
242243

243244
Instant runEnd = Instant.now().plus(1, SECONDS);
244245
while (Instant.now().isBefore(runEnd)) {

0 commit comments

Comments
 (0)