定点重置数据改成了定时器方式
This commit is contained in:
parent
5ae1b474f9
commit
59a6641d50
22
src/main/java/com/yutou/bilibili/Tools/ApplicationTime.java
Normal file
22
src/main/java/com/yutou/bilibili/Tools/ApplicationTime.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import com.yutou.bilibili.services.LiveDanmuService;
|
||||
import com.yutou.bilibili.services.LiveVideoDownloadService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@EnableScheduling
|
||||
public class ApplicationTime {
|
||||
@Resource
|
||||
LiveVideoDownloadService videoService;
|
||||
@Resource
|
||||
LiveDanmuService danmuService;
|
||||
@Scheduled(cron = "1 0 * * * *")
|
||||
public void reset(){
|
||||
videoService.clearUserStopList();
|
||||
danmuService.clearUserList();
|
||||
}
|
||||
}
|
@ -37,7 +37,6 @@ public class SystemService {
|
||||
return config.getTimerLoop();
|
||||
}
|
||||
|
||||
private final String resetTimer = "00:00:00 - 00:01:00";
|
||||
|
||||
public void start() {
|
||||
if (timer == null) {
|
||||
@ -50,10 +49,6 @@ public class SystemService {
|
||||
scheduled = timer.scheduleAtFixedRate(() -> {
|
||||
List<LiveConfigDatabaseBean> list = databasesService.getConfigDatabase().getAllConfig();
|
||||
Log.i("循环任务:" + list.size());
|
||||
if (DateFormatUtils.getInstance().checkTime(null, resetTimer)) {
|
||||
videoService.clearUserStopList();
|
||||
danmuService.clearUserList();
|
||||
}
|
||||
for (LiveConfigDatabaseBean bean : list) {
|
||||
try {
|
||||
// 如果bean需要录制弹幕,并且检查录制弹幕时间,并且不需要同步直播弹幕,则录制弹幕
|
||||
|
Loading…
Reference in New Issue
Block a user