Skip to content

Commit 0b1f0cb

Browse files
CLAP-480 엘라스틱서치 장시간 미사용시 연결 끊어지는 버그 수정
CLAP-480 엘라스틱서치 장시간 미사용시 연결 끊어지는 버그 수정
2 parents dec04f0 + 2ad9bd7 commit 0b1f0cb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package clap.server.adapter.outbound.infrastructure.elastic.scheduler;
2+
3+
import co.elastic.clients.elasticsearch.ElasticsearchClient;
4+
import lombok.RequiredArgsConstructor;
5+
import lombok.extern.slf4j.Slf4j;
6+
import org.springframework.scheduling.annotation.Scheduled;
7+
import org.springframework.stereotype.Component;
8+
9+
@Component
10+
@RequiredArgsConstructor
11+
@Slf4j
12+
public class ElasticsearchConnectionScheduler {
13+
private final ElasticsearchClient client;
14+
15+
@Scheduled(fixedRate = 30000)
16+
public void keepConnectionAlive() {
17+
try {
18+
if (!client.ping().value()) {
19+
log.error("Elasticsearch 연결 실패");
20+
}
21+
} catch (Exception e) {
22+
log.error("Elasticsearch 연결 중 예외 발생: {}", e.getMessage());
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)