提交 93204ead authored 作者: 黄承天's avatar 黄承天

fix(user):启动时会执行一次同步任务

上级 b095e363
......@@ -3,6 +3,7 @@ package org.matrix.remote.task;
import lombok.extern.slf4j.Slf4j;
import org.matrix.remote.service.DataCollector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
......@@ -11,7 +12,7 @@ import org.springframework.stereotype.Component;
*/
@Slf4j
@Component
public class DataCollectorTask {
public class DataCollectorTask implements CommandLineRunner {
@Autowired
......@@ -22,10 +23,15 @@ public class DataCollectorTask {
* 每小时收集一次
*/
@Scheduled(cron = "0 0 */1 * * ?")
public void collect(){
public void collect() {
log.info("同步禅道用户项目数据...");
dataCollector.execute();
log.info("同步结束....");
}
@Override
public void run(String... args) {
collect();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论