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