Skip to content

Commit

Permalink
fix timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
see101702 committed Oct 19, 2023
1 parent 845bb05 commit dc1c2a3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

Expand Down Expand Up @@ -38,7 +39,10 @@ public String springToFlask(User user) {
HttpEntity<String> requestEntity = new HttpEntity<>(userId, headers);

//RestTemplate를 사용하여 POST 요청 보내기
RestTemplate restTemplate = new RestTemplate();
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setReadTimeout(10000); // 읽기 타임아웃을 10초로 설정 (밀리초)
factory.setConnectTimeout(5000); // 연결 타임아웃을 5초로 설정 (밀리초)
RestTemplate restTemplate = new RestTemplate(factory);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(flaskApiUrl, requestEntity, String.class);

if (responseEntity.getStatusCode().is2xxSuccessful()) {
Expand Down

0 comments on commit dc1c2a3

Please sign in to comment.