Skip to content

Commit

Permalink
[fix][io] Update Elasticsearch sink idle cnx timeout to 30s (#19377)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1481c74)
  • Loading branch information
michaeljmarshall committed Jan 31, 2023
1 parent 0271cd9 commit dbe1c0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ public class ElasticSearchConfig implements Serializable {

@FieldDoc(
required = false,
defaultValue = "5",
help = "Idle connection timeout to prevent a read timeout."
defaultValue = "30000",
help = "Idle connection timeout to prevent a connection timeout due to inactivity."
)
private int connectionIdleTimeoutInMs = 5;
private int connectionIdleTimeoutInMs = 30000;

@FieldDoc(
required = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public RestClient(ElasticSearchConfig elasticSearchConfig, BulkProcessor.Listene
// idle+expired connection evictor thread
this.executorService = Executors.newSingleThreadScheduledExecutor();
this.executorService.scheduleAtFixedRate(() -> {
configCallback.connectionManager.closeExpiredConnections();
configCallback.connectionManager.closeIdleConnections(
config.getConnectionIdleTimeoutInMs(), TimeUnit.MILLISECONDS);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public final void defaultValueTest() throws IOException {
assertEquals(config.isCompressionEnabled(), false);
assertEquals(config.getConnectTimeoutInMs(), 5000L);
assertEquals(config.getConnectionRequestTimeoutInMs(), 1000L);
assertEquals(config.getConnectionIdleTimeoutInMs(), 5L);
assertEquals(config.getConnectionIdleTimeoutInMs(), 30000L);
assertEquals(config.getSocketTimeoutInMs(), 60000);

assertEquals(config.isStripNulls(), true);
Expand Down

0 comments on commit dbe1c0a

Please sign in to comment.