알림 api 수정
This commit is contained in:
@@ -34,16 +34,35 @@ export class RiskAlertCacheService {
|
||||
*/
|
||||
public startAutoRefresh(): void {
|
||||
console.log('🔄 리스크/알림 자동 갱신 시작 (10분 간격)');
|
||||
console.log(' - 기상특보: 즉시 호출');
|
||||
console.log(' - 교통사고/도로공사: 10분 후 첫 호출');
|
||||
|
||||
// 즉시 첫 갱신
|
||||
this.refreshCache();
|
||||
// 기상특보만 즉시 호출 (ITS API는 10분 후부터)
|
||||
this.refreshWeatherOnly();
|
||||
|
||||
// 10분마다 갱신 (600,000ms)
|
||||
// 10분마다 전체 갱신 (600,000ms)
|
||||
this.updateInterval = setInterval(() => {
|
||||
this.refreshCache();
|
||||
}, 10 * 60 * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 기상특보만 갱신 (재시작 시 사용)
|
||||
*/
|
||||
private async refreshWeatherOnly(): Promise<void> {
|
||||
try {
|
||||
console.log('🌤️ 기상특보만 즉시 갱신 중...');
|
||||
const weatherAlerts = await this.riskAlertService.getWeatherAlerts();
|
||||
|
||||
this.cachedAlerts = weatherAlerts;
|
||||
this.lastUpdated = new Date();
|
||||
|
||||
console.log(`✅ 기상특보 갱신 완료! (${weatherAlerts.length}건)`);
|
||||
} catch (error: any) {
|
||||
console.error('❌ 기상특보 갱신 실패:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 자동 갱신 중지
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user