timeout increase
This commit is contained in:
@@ -118,7 +118,13 @@ public class ReportController {
|
||||
.doOnError(e -> {
|
||||
System.err.println("Error generating research report async: " + e.getMessage());
|
||||
})
|
||||
.subscribe();
|
||||
.subscribe(
|
||||
ok -> {
|
||||
},
|
||||
err -> {
|
||||
// Avoid onErrorDropped by consuming error here
|
||||
System.err.println("Async pipeline error: " + err.getMessage());
|
||||
});
|
||||
|
||||
ReportGenerationResponse response = new ReportGenerationResponse(
|
||||
taskId,
|
||||
|
||||
@@ -25,7 +25,7 @@ public class DeepResearchService {
|
||||
@Value("${deep-research.api.url:http://185.35.223.45:3051}")
|
||||
private String apiUrl;
|
||||
|
||||
@Value("${deep-research.api.timeout:300000}") // 5 minutes default timeout
|
||||
@Value("${deep-research.api.timeout:300000}") // Set to 0 or negative to disable timeout
|
||||
private long timeoutMs;
|
||||
|
||||
public DeepResearchService() {
|
||||
@@ -40,13 +40,15 @@ public class DeepResearchService {
|
||||
*/
|
||||
public DeepResearchResponse generateReport(DeepResearchRequest request) {
|
||||
try {
|
||||
return webClient.post()
|
||||
Mono<DeepResearchResponse> call = webClient.post()
|
||||
.uri(apiUrl + "/api/research")
|
||||
.bodyValue(request)
|
||||
.retrieve()
|
||||
.bodyToMono(DeepResearchResponse.class)
|
||||
.timeout(Duration.ofMillis(timeoutMs))
|
||||
.block();
|
||||
.bodyToMono(DeepResearchResponse.class);
|
||||
if (timeoutMs > 0) {
|
||||
call = call.timeout(Duration.ofMillis(timeoutMs));
|
||||
}
|
||||
return call.block();
|
||||
} catch (WebClientResponseException e) {
|
||||
throw new RuntimeException("Deep research API error: " + e.getResponseBodyAsString(), e);
|
||||
} catch (Exception e) {
|
||||
@@ -67,15 +69,19 @@ public class DeepResearchService {
|
||||
.bodyToMono(DeepResearchResponse.class)
|
||||
// 👇 Log the successful response object here
|
||||
.doOnSuccess(response -> {
|
||||
log.info("Deep research API response: {}", response.getLearnings());
|
||||
log.info("Deep research API response: {}", response.getMainContent());
|
||||
log.info("Deep research API response: {}", response.getError());
|
||||
log.info("Deep research API response: {}", response.getStatus());
|
||||
log.info("Deep research API response: {}", response.getVisitedUrls());
|
||||
})
|
||||
.timeout(Duration.ofMillis(timeoutMs))
|
||||
.onErrorMap(WebClientResponseException.class,
|
||||
e -> new RuntimeException("Deep research API error: " + e.getResponseBodyAsString(), e))
|
||||
if (response != null) {
|
||||
log.info("Deep research API response: {}", response.getLearnings());
|
||||
log.info("Deep research API response: {}", response.getMainContent());
|
||||
log.info("Deep research API response: {}", response.getError());
|
||||
log.info("Deep research API response: {}", response.getStatus());
|
||||
log.info("Deep research API response: {}", response.getVisitedUrls());
|
||||
}
|
||||
});
|
||||
if (timeoutMs > 0) {
|
||||
temp = temp.timeout(Duration.ofMillis(timeoutMs));
|
||||
}
|
||||
temp = temp.onErrorMap(WebClientResponseException.class,
|
||||
e -> new RuntimeException("Deep research API error: " + e.getResponseBodyAsString(), e))
|
||||
.onErrorMap(Exception.class, e -> new RuntimeException("Failed to call deep research API", e));
|
||||
log.info("*************");
|
||||
return temp;
|
||||
|
||||
@@ -62,4 +62,4 @@ spring.mail.properties.mail.smtp.starttls.required=true
|
||||
|
||||
# Deep Research API Configuration
|
||||
deep-research.api.url=http://185.35.223.45:3051
|
||||
deep-research.api.timeout=300000
|
||||
deep-research.api.timeout=900000
|
||||
|
||||
Reference in New Issue
Block a user