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
public CorsConfigurationSource corsConfigurationSource() {
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.setAllowedHeaders(List.of("*"));
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
@@ -4,10 +4,12 @@ import company.specialsource.entity.ScrapedPost;
import company.specialsource.repository.ScrapedPostRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
* 목록에 새로 나타난 글만 상세페이지까지 들어가서 본문을 수집한다.
@@ -18,11 +20,15 @@ import java.util.List;
@RequiredArgsConstructor
public class ScrapedPostSyncService {
private static final long DELAY_BETWEEN_DETAIL_FETCHES_MS = 800;
private final ScrapedPostRepository scrapedPostRepository;
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) {
int savedCount = 0;
for (ScrapedPostDto post : posts) {
@@ -64,7 +70,7 @@ public class ScrapedPostSyncService {
private void sleepQuietly() {
try {
Thread.sleep(DELAY_BETWEEN_DETAIL_FETCHES_MS);
Thread.sleep(ThreadLocalRandom.current().nextLong(detailDelayMinMs, detailDelayMaxMs + 1));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}