From dc450d6ce108594ec32578cc34f2acce8a2eeea9 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 7 Mar 2023 17:17:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/common/StaticScheduleTask.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/com/xkrs/common/StaticScheduleTask.java diff --git a/src/main/java/com/xkrs/common/StaticScheduleTask.java b/src/main/java/com/xkrs/common/StaticScheduleTask.java new file mode 100644 index 0000000..6213695 --- /dev/null +++ b/src/main/java/com/xkrs/common/StaticScheduleTask.java @@ -0,0 +1,26 @@ +package com.xkrs.common; + +import com.xkrs.straw.utils.FirePointSubscribeManager; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +import javax.annotation.Resource; + +/** + * 更新订阅计划任务 + */ +@Configuration +@EnableScheduling +public class StaticScheduleTask { + + @Resource + private FirePointSubscribeManager firePointSubscribeManager; + + //每两小时更新一次订阅 + @Scheduled(cron = "0 0 */2 * * ?") + private void syncSubscribe() { + firePointSubscribeManager.autoSync(); + } + +} \ No newline at end of file