Use ai.retry settings, add AI connect timeout, stop logging post text
AiRetryProperties was bound but @Retryable had hard-coded values, so ai.retry.* in application.yaml had no effect. WebClient had no connect timeout (Netty default 30 s per attempt). TextModerationProcessor logged the whole moderation context, including post text, at INFO. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.krylov.refound.ai.config;
|
||||
|
||||
import io.netty.channel.ChannelOption;
|
||||
import java.time.Duration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import reactor.netty.http.client.HttpClient;
|
||||
@@ -14,11 +15,15 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
@EnableConfigurationProperties(AiProperties.class)
|
||||
public class WebClientConfig {
|
||||
|
||||
private static final int CONNECT_TIMEOUT_MILLIS = 3_000;
|
||||
|
||||
@Bean
|
||||
public WebClient aiWebClient(AiProperties properties) {
|
||||
log.info("aiWebClient get for properties {}", properties);
|
||||
HttpClient httpClient =
|
||||
HttpClient.create()
|
||||
// Без явного таймаута соединения недоступный хост держал поток модерации ~30 с на попытку
|
||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECT_TIMEOUT_MILLIS)
|
||||
.responseTimeout(
|
||||
Duration.ofSeconds(properties.getTimeout())
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user