This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 727d146a5f fix: Reuse Influx connection pool (#3375)
727d146a5f is described below
commit 727d146a5ffea3f06bca1f21c24d622ded8ee2be
Author: Dominik Riemer <[email protected]>
AuthorDate: Mon Dec 16 13:49:00 2024 +0100
fix: Reuse Influx connection pool (#3375)
---
.../streampipes/dataexplorer/influx/client/InfluxClientUtils.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/client/InfluxClientUtils.java
b/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/client/InfluxClientUtils.java
index 9b0d14d1ce..40f67fd780 100644
---
a/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/client/InfluxClientUtils.java
+++
b/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/client/InfluxClientUtils.java
@@ -20,12 +20,15 @@ package org.apache.streampipes.dataexplorer.influx.client;
import org.apache.streampipes.dataexplorer.influx.auth.AuthInterceptor;
+import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import java.util.concurrent.TimeUnit;
public class InfluxClientUtils {
+ private static final ConnectionPool connectionPool = new ConnectionPool(10,
10, TimeUnit.MINUTES);
+
public static OkHttpClient.Builder getHttpClientBuilder(String authToken) {
var builder = getHttpClientBuilder()
.addInterceptor(new AuthInterceptor(authToken));
@@ -35,6 +38,7 @@ public class InfluxClientUtils {
public static OkHttpClient.Builder getHttpClientBuilder() {
return new OkHttpClient().newBuilder()
+ .connectionPool(connectionPool)
.connectTimeout(120, TimeUnit.SECONDS)
.readTimeout(120, TimeUnit.SECONDS)
.writeTimeout(120, TimeUnit.SECONDS);