Commit 4e52a56c30221b464cbf9d36f675a60ca8ef2a00

Authored by 王明元
1 parent d472478d

2022年6月30日18:21:52

src/main/java/cn/fw/freya/task/DataCaptureTask.java
... ... @@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
16 16 import lombok.RequiredArgsConstructor;
17 17 import lombok.extern.slf4j.Slf4j;
18 18 import org.springframework.context.ApplicationEventPublisher;
  19 +import org.springframework.scheduling.annotation.Scheduled;
19 20 import org.springframework.stereotype.Component;
20 21 import org.springframework.util.CollectionUtils;
21 22  
... ... @@ -50,7 +51,7 @@ public class DataCaptureTask {
50 51 /**
51 52 * 每分钟执行多线程同时抓取数据
52 53 */
53   - //@Scheduled(cron = "0 0/1 * * * ?")
  54 + @Scheduled(cron = "0 0/1 * * * ?")
54 55 public void capture() {
55 56 final ThreadPoolExecutor threadPoolExecutor = ThreadPoolUtil.getThreadPool();
56 57 BlockingQueue<Runnable> queue = threadPoolExecutor.getQueue();// 获取工作队列
... ... @@ -96,7 +97,7 @@ public class DataCaptureTask {
96 97 /**
97 98 * 每2分钟执行抓取数据
98 99 */
99   - //@Scheduled(fixedRate = 2 * 60 * 1000, initialDelay = 5000)
  100 + @Scheduled(fixedRate = 2 * 60 * 1000, initialDelay = 5000)
100 101 public void captureLivePlayback() {
101 102 Double durationThreshold = 60d;// 设置直播时长阈值
102 103 final Random random = new Random();
... ...