diff --git a/src/main/kotlin/me/wypark/blogbackend/core/config/MaiaConfig.kt b/src/main/kotlin/me/wypark/blogbackend/core/config/MaiaConfig.kt index 4a49ed9..0d43152 100644 --- a/src/main/kotlin/me/wypark/blogbackend/core/config/MaiaConfig.kt +++ b/src/main/kotlin/me/wypark/blogbackend/core/config/MaiaConfig.kt @@ -4,6 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.http.client.SimpleClientHttpRequestFactory import org.springframework.web.client.RestClient import java.time.Duration @@ -16,8 +17,13 @@ class MaiaConfig { builder: RestClient.Builder, properties: MaiaProperties ): RestClient { + val requestFactory = SimpleClientHttpRequestFactory().apply { + setConnectTimeout(Duration.ofSeconds(5)) + setReadTimeout(Duration.ofSeconds(120)) + } return builder .baseUrl(properties.engineUrl) + .requestFactory(requestFactory) .build() } } diff --git a/src/main/kotlin/me/wypark/blogbackend/domain/chess/MaiaEngineClient.kt b/src/main/kotlin/me/wypark/blogbackend/domain/chess/MaiaEngineClient.kt index 81394c8..aa3cd28 100644 --- a/src/main/kotlin/me/wypark/blogbackend/domain/chess/MaiaEngineClient.kt +++ b/src/main/kotlin/me/wypark/blogbackend/domain/chess/MaiaEngineClient.kt @@ -1,6 +1,7 @@ package me.wypark.blogbackend.domain.chess import org.slf4j.LoggerFactory +import org.springframework.http.MediaType import org.springframework.stereotype.Component import org.springframework.web.client.RestClient import org.springframework.web.client.RestClientException @@ -26,6 +27,8 @@ class MaiaEngineClient( return maiaRestClient .post() .uri(path) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) .body(request) .retrieve() .body(responseType)