timeout increased
This commit is contained in:
@@ -12,9 +12,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import reactor.netty.http.client.HttpClient;
|
||||
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
|
||||
|
||||
@Service
|
||||
public class OllamaAnalyticsService {
|
||||
|
||||
@@ -25,9 +29,23 @@ public class OllamaAnalyticsService {
|
||||
@Value("${ollama.model:gemma3:1b}")
|
||||
private String modelName;
|
||||
|
||||
@Value("${ollama.timeoutMs:60000}")
|
||||
private long timeoutMs;
|
||||
|
||||
@Value("${ollama.connectTimeoutMs:10000}")
|
||||
private int connectTimeoutMs;
|
||||
|
||||
@Value("${ollama.responseTimeoutMs:60000}")
|
||||
private long responseTimeoutMs;
|
||||
|
||||
public OllamaAnalyticsService(@Value("${ollama.host:http://185.35.223.45:11434}") String ollamaHost) {
|
||||
HttpClient httpClient = HttpClient.create()
|
||||
.compress(true)
|
||||
.responseTimeout(Duration.ofMillis(responseTimeoutMs));
|
||||
|
||||
this.webClient = WebClient.builder()
|
||||
.baseUrl(ollamaHost)
|
||||
.clientConnector(new ReactorClientHttpConnector(httpClient))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -103,7 +121,7 @@ public class OllamaAnalyticsService {
|
||||
logger.warn("Ollama request failed: {}", err.getMessage());
|
||||
return Mono.empty();
|
||||
})
|
||||
.block();
|
||||
.block(Duration.ofMillis(timeoutMs));
|
||||
|
||||
if (response == null) {
|
||||
return null;
|
||||
@@ -137,7 +155,7 @@ public class OllamaAnalyticsService {
|
||||
logger.warn("Ollama request failed: {}", err.getMessage());
|
||||
return Mono.empty();
|
||||
})
|
||||
.block();
|
||||
.block(Duration.ofMillis(timeoutMs));
|
||||
|
||||
if (response == null) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user