fix: hotfix 동기화 — history/detail candidate_count 안전 처리 #225

병합
htlee hotfix/sync-candidate-count 에서 develop 로 69 commits 를 머지했습니다 2026-04-04 11:05:43 +09:00
Showing only changes of commit 1029e07432 - Show all commits

파일 보기

@ -24,6 +24,9 @@ public class GroupPolygonService {
private final CacheManager cacheManager;
private final ObjectMapper objectMapper;
private static final long CACHE_TTL_MS = 5 * 60_000L; // 5분
private volatile long lastCacheTime = 0;
private static final String LATEST_GROUPS_SQL = """
SELECT group_type, group_key, group_label, snapshot_time,
ST_AsGeoJSON(polygon) AS polygon_geojson,
@ -61,7 +64,9 @@ public class GroupPolygonService {
@SuppressWarnings("unchecked")
public List<GroupPolygonDto> getLatestGroups() {
Cache cache = cacheManager.getCache(CacheConfig.GROUP_POLYGONS);
if (cache != null) {
long now = System.currentTimeMillis();
if (cache != null && (now - lastCacheTime) < CACHE_TTL_MS) {
Cache.ValueWrapper wrapper = cache.get("data");
if (wrapper != null) {
return (List<GroupPolygonDto>) wrapper.get();
@ -72,6 +77,7 @@ public class GroupPolygonService {
if (cache != null) {
cache.put("data", results);
lastCacheTime = now;
}
return results;
}