Skip to content

Commit 0cd416e

Browse files
committed
Reduce default keepalive time to align with Azure defaults
JAVA-3743
1 parent 1ab6eb8 commit 0cd416e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

driver-core/src/main/com/mongodb/internal/connection/SocketStreamHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
final class SocketStreamHelper {
3838
// Keep alive options and their values for Java 11+
3939
private static final String TCP_KEEPIDLE = "TCP_KEEPIDLE";
40-
private static final int TCP_KEEPIDLE_DURATION = 300;
40+
private static final int TCP_KEEPIDLE_DURATION = 120;
4141
private static final String TCP_KEEPCOUNT = "TCP_KEEPCOUNT";
4242
private static final int TCP_KEEPCOUNT_LIMIT = 9;
4343
private static final String TCP_KEEPINTERVAL = "TCP_KEEPINTERVAL";

driver-core/src/test/functional/com/mongodb/internal/connection/SocketStreamHelperSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class SocketStreamHelperSpecification extends Specification {
5555
if (Arrays.stream(ExtendedSocketOptions.getDeclaredFields()).anyMatch{ f -> f.getName().equals('TCP_KEEPCOUNT') }) {
5656
Method getOptionMethod = Socket.getMethod('getOption', SocketOption);
5757
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPCOUNT').get(null)) == 9
58-
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPIDLE').get(null)) == 300
58+
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPIDLE').get(null)) == 120
5959
getOptionMethod.invoke(socket, ExtendedSocketOptions.getDeclaredField('TCP_KEEPINTERVAL').get(null)) == 10
6060
}
6161

0 commit comments

Comments
 (0)