aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-10-23 10:19:37 +0300
committerGravatar Vitaly Takmazov2023-10-23 10:19:37 +0300
commit8dea805d38cc1b48e82fef7c04dd00e3f2a93691 (patch)
tree7b650af83e9dcac3e5e44650943d0cba77533982 /src/main/java/com
parentf08abdf936c6ebc303f1ade8d7bbc8dbe4c77708 (diff)
ActivityPub: using single-thread for http client
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/config/HttpClientConfig.java3
1 files changed, 3 insertions, 0 deletions
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())