File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
dd-trace-core/src/main/java/datadog/trace/lambda Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 1515import java .io .ByteArrayInputStream ;
1616import java .nio .charset .StandardCharsets ;
1717import java .util .Base64 ;
18+ import okhttp3 .ConnectionPool ;
1819import okhttp3 .MediaType ;
1920import okhttp3 .OkHttpClient ;
2021import okhttp3 .Request ;
@@ -49,6 +50,8 @@ public class LambdaHandler {
4950 private static final String END_INVOCATION = "/lambda/end-invocation" ;
5051
5152 private static final Long REQUEST_TIMEOUT_IN_S = 1L ;
53+ private static final int MAX_IDLE_CONNECTIONS = 5 ;
54+ private static final Long KEEP_ALIVE_DURATION = 300L ;
5255
5356 private static OkHttpClient HTTP_CLIENT =
5457 new OkHttpClient .Builder ()
@@ -57,6 +60,7 @@ public class LambdaHandler {
5760 .writeTimeout (REQUEST_TIMEOUT_IN_S , SECONDS )
5861 .readTimeout (REQUEST_TIMEOUT_IN_S , SECONDS )
5962 .callTimeout (REQUEST_TIMEOUT_IN_S , SECONDS )
63+ .connectionPool (new ConnectionPool (MAX_IDLE_CONNECTIONS , KEEP_ALIVE_DURATION , SECONDS ))
6064 .build ();
6165
6266 private static final MediaType jsonMediaType = MediaType .parse ("application/json" );
You can’t perform that action at this time.
0 commit comments