From 95463bfc144d728731a2e264e2575bc2ce996848 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Fri, 27 Sep 2024 00:16:52 -0700 Subject: [PATCH] Separate executors --- src/main/java/com/amplitude/HttpTransport.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/amplitude/HttpTransport.java b/src/main/java/com/amplitude/HttpTransport.java index 035b300..e4f3152 100644 --- a/src/main/java/com/amplitude/HttpTransport.java +++ b/src/main/java/com/amplitude/HttpTransport.java @@ -46,7 +46,8 @@ class HttpTransport { // Managed by setters private ExecutorService retryThreadPool = Executors.newFixedThreadPool(10); - private ExecutorService sendThreadPool = Executors.newFixedThreadPool(40); + private ExecutorService sendThreadPool = Executors.newFixedThreadPool(20); + private ExecutorService supplyAsyncPool = Executors.newCachedThreadPool(); HttpTransport( HttpCall httpCall, AmplitudeCallbacks callbacks, AmplitudeLog logger, long flushTimeout) { @@ -126,7 +127,7 @@ private CompletableFuture sendEvents(List events) { throw new CompletionException(e); } return response; - }, sendThreadPool); + }, supplyAsyncPool); } // Call this function if event not in current Retry list.