From 8dea805d38cc1b48e82fef7c04dd00e3f2a93691 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 23 Oct 2023 10:19:37 +0300 Subject: ActivityPub: using single-thread for http client --- src/main/java/com/juick/config/HttpClientConfig.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/juick/config/HttpClientConfig.java b/src/main/java/com/juick/config/HttpClientConfig.java index 457a63c8..2540f4db 100644 --- a/src/main/java/com/juick/config/HttpClientConfig.java +++ b/src/main/java/com/juick/config/HttpClientConfig.java @@ -18,6 +18,7 @@ package com.juick.config; import com.juick.util.ActivityPubRequestInterceptor; +import okhttp3.Dispatcher; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import org.slf4j.Logger; @@ -27,6 +28,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import javax.inject.Inject; +import java.util.concurrent.Executors; @Configuration public class HttpClientConfig { @@ -36,6 +38,7 @@ public class HttpClientConfig { @Bean public OkHttpClient httpClient() { return new OkHttpClient.Builder() + .dispatcher(new Dispatcher(Executors.newFixedThreadPool(1))) .addInterceptor(new HttpLoggingInterceptor(logger::debug) .setLevel(HttpLoggingInterceptor.Level.BASIC)) .addInterceptor(new ActivityPubRequestInterceptor()) -- cgit v1.2.3