fix : 홈페이지 교체로 인한 수정
SpecialSource Backend CI/CD / build-and-deploy (push) Successful in 54s

This commit is contained in:
headporter committed 2026-11-26 13:28:49 +09:00
1 parent 569346ef31
commit 27d89f35a2
3 files changed
+12 -4

No files matched your search

@@ -44,7 +44,7 @@ public class SecurityConfig {
@Bean @Bean
public CorsConfigurationSource corsConfigurationSource() { public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration(); CorsConfiguration config = new CorsConfiguration();
config.setAllowedOriginPatterns(List.of("http://localhost:*", "https://new.specialsource.company")); config.setAllowedOriginPatterns(List.of("http://localhost:*", "https://specialsource.company", "https://www.specialsource.company", "https://new.specialsource.company"));
config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS")); config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
config.setAllowedHeaders(List.of("*")); config.setAllowedHeaders(List.of("*"));
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
@@ -4,10 +4,12 @@ import company.specialsource.entity.ScrapedPost;
import company.specialsource.repository.ScrapedPostRepository; import company.specialsource.repository.ScrapedPostRepository;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/** /**
* 목록에 새로 나타난 글만 상세페이지까지 들어가서 본문을 수집한다. * 목록에 새로 나타난 글만 상세페이지까지 들어가서 본문을 수집한다.
@@ -18,11 +20,15 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
public class ScrapedPostSyncService { public class ScrapedPostSyncService {
private static final long DELAY_BETWEEN_DETAIL_FETCHES_MS = 800;
private final ScrapedPostRepository scrapedPostRepository; private final ScrapedPostRepository scrapedPostRepository;
private final PostDetailScraperService postDetailScraperService; private final PostDetailScraperService postDetailScraperService;
// 상세페이지 요청 사이 대기: min~max 사이 랜덤
@Value("${scraping.detail-delay-min-ms:3000}")
private long detailDelayMinMs;
@Value("${scraping.detail-delay-max-ms:6000}")
private long detailDelayMaxMs;
public int saveNewPosts(BoardSource source, List<ScrapedPostDto> posts) { public int saveNewPosts(BoardSource source, List<ScrapedPostDto> posts) {
int savedCount = 0; int savedCount = 0;
for (ScrapedPostDto post : posts) { for (ScrapedPostDto post : posts) {
@@ -64,7 +70,7 @@ public class ScrapedPostSyncService {
private void sleepQuietly() { private void sleepQuietly() {
try { try {
Thread.sleep(DELAY_BETWEEN_DETAIL_FETCHES_MS); Thread.sleep(ThreadLocalRandom.current().nextLong(detailDelayMinMs, detailDelayMaxMs + 1));
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
+2
View File
@@ -42,6 +42,8 @@ scraping:
initial-delay-ms: 10000 # 앱 기동 후 첫 스크래핑까지 대기 시간 initial-delay-ms: 10000 # 앱 기동 후 첫 스크래핑까지 대기 시간
interval-min-ms: 600000 # 게시판 전체 스크래핑 주기: 이전 실행이 끝난 뒤 min~max 사이 랜덤 (10~20분) interval-min-ms: 600000 # 게시판 전체 스크래핑 주기: 이전 실행이 끝난 뒤 min~max 사이 랜덤 (10~20분)
interval-max-ms: 1200000 interval-max-ms: 1200000
detail-delay-min-ms: 3000 # 새 글 상세페이지 요청 사이 대기: min~max 사이 랜덤 (3~6초)
detail-delay-max-ms: 6000
retention-days: 7 # 이 기간(scraped_at 기준)이 지난 게시물은 자동 삭제 retention-days: 7 # 이 기간(scraped_at 기준)이 지난 게시물은 자동 삭제
cleanup-initial-delay-ms: 60000 # 앱 기동 후 첫 정리 작업까지 대기 시간 cleanup-initial-delay-ms: 60000 # 앱 기동 후 첫 정리 작업까지 대기 시간
cleanup-interval-ms: 86400000 # 정리 작업 주기 (24시간) cleanup-interval-ms: 86400000 # 정리 작업 주기 (24시간)