Skip to content

Commit 111e424

Browse files
authored
Update SubwaySectionService.java
1 parent 697caf3 commit 111e424

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/main/java/com/example/busnotice/domain/subway/SubwaySectionService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
import org.springframework.http.ResponseEntity;
1111
import org.springframework.stereotype.Service;
1212
import org.springframework.web.client.RestTemplate;
13+
import org.springframework.web.client.HttpClientErrorException;
14+
import org.springframework.web.client.HttpServerErrorException;
15+
import org.springframework.web.client.ResourceAccessException;
16+
17+
import java.net.SocketTimeoutException;
1318

1419
import java.net.URLEncoder;
1520
import java.nio.charset.StandardCharsets;
@@ -75,6 +80,14 @@ public List<MergedStationDto> fetchMergedStationList(String stName) {
7580
}
7681

7782
// 특정 호선을 지나는 지하철역 리스트 반환
83+
@Retryable(
84+
retryFor = {
85+
SocketTimeoutException.class, ResourceAccessException.class, HttpServerErrorException.class
86+
},
87+
exclude = { HttpClientErrorException.class },
88+
maxAttempts = 3,
89+
backoff = @Backoff(delay = 1000)
90+
)
7891
@Cacheable(value = "subwayStationsOfLine", key = "#p0")
7992
public List<SubwayStationOfLineDto> getStationsOfLine(LineType lineType) {
8093
String url = String.format(

0 commit comments

Comments
 (0)