diff --git a/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/configuration/feign/FmkoreaClientFeignConfiguration.java b/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/configuration/feign/FmkoreaClientFeignConfiguration.java deleted file mode 100644 index 54a516b..0000000 --- a/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/configuration/feign/FmkoreaClientFeignConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.myoa.engineering.crawl.shopping.configuration.feign; - -import feign.RequestInterceptor; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class FmkoreaClientFeignConfiguration { - - - @Bean - public RequestInterceptor requestInterceptor() { - // TODO ignore 4xx - return requestTemplate -> new FakeUserAgentInterceptor().apply(requestTemplate); - } - - @Bean - public FmkoreaClientErrorDecoder errorDecoder() { - return new FmkoreaClientErrorDecoder(); - } - -/* - @Bean - public FmkoreaBoardClient fmkoreaBoardClient(RateLimiterRegistry rateLimiterRegistry, - CircuitBreakerRegistry circuitBreakerRegistry, - RequestInterceptor requestInterceptor) { - FeignDecorators decorators = FeignDecorators.builder() - .withCircuitBreaker(circuitBreakerRegistry.circuitBreaker("rateLimit")) - .withRateLimiter(rateLimiterRegistry.rateLimiter("rateLimit")) - .build(); - - return Resilience4jFeign.builder(decorators) - .requestInterceptor(requestInterceptor) - .target(FmkoreaBoardClient.class, "https://www.fmkorea.com"); - } -*/ - - -} - diff --git a/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/scheduler/ParseEventEmitter.java b/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/scheduler/ParseEventEmitter.java index c53610e..4d24eee 100644 --- a/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/scheduler/ParseEventEmitter.java +++ b/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/scheduler/ParseEventEmitter.java @@ -1,12 +1,14 @@ package com.myoa.engineering.crawl.shopping.scheduler; import com.myoa.engineering.crawl.shopping.crawlhandler.CrawlHandler; +import com.myoa.engineering.crawl.shopping.support.dto.constant.CrawlTarget; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import java.util.Arrays; import java.util.List; @Slf4j @@ -23,8 +25,9 @@ public class ParseEventEmitter { @Scheduled(cron = "0 0/15 * * * ?") public void emit() { - log.info("[emit] trigger fired!"); - crawlHandlers.forEach(CrawlHandler::handle); - + crawlHandlers + .stream() + .filter(e -> e.getCrawlTarget().isAvailable()) + .forEach(CrawlHandler::handle); } } diff --git a/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/service/slack/UserNotifyService.java b/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/service/slack/UserNotifyService.java index be4b224..f751acc 100644 --- a/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/service/slack/UserNotifyService.java +++ b/shopping-crawler/src/main/java/com/myoa/engineering/crawl/shopping/service/slack/UserNotifyService.java @@ -33,13 +33,6 @@ public class UserNotifyService { } } - public ChatPostMessageRequest.ChatPostMessageRequestBuilder generateMessage(String message) { - return ChatPostMessageRequest.builder() - .channel(slackSecretProperties.getChannel()) - .username(slackSecretProperties.getUsername()) - .text(message); - } - public ChatPostMessageRequest.ChatPostMessageRequestBuilder generateMessage() { return ChatPostMessageRequest.builder() .channel(slackSecretProperties.getChannel()) diff --git a/support/src/main/java/com/myoa/engineering/crawl/shopping/support/dto/constant/CrawlTarget.java b/support/src/main/java/com/myoa/engineering/crawl/shopping/support/dto/constant/CrawlTarget.java index f3e3392..713a780 100644 --- a/support/src/main/java/com/myoa/engineering/crawl/shopping/support/dto/constant/CrawlTarget.java +++ b/support/src/main/java/com/myoa/engineering/crawl/shopping/support/dto/constant/CrawlTarget.java @@ -8,7 +8,7 @@ import lombok.Getter; public enum CrawlTarget { PPOMPPU_DOMESTIC("뽐뿌국내", true), PPOMPPU_OVERSEA("뽐뿌해외", true), - FMKOREA("펨코", true), + FMKOREA("펨코", false), ; private final String alias;