fix: 十分钟周期
This commit is contained in:
parent
a3f3c78b49
commit
1294cc8d4f
@ -243,7 +243,7 @@ public class TcpRtkServer implements CommandLineRunner {
|
||||
}
|
||||
|
||||
// 每10分钟执行一次数据保存
|
||||
@Scheduled(fixedRate = 6000) // 600000毫秒 = 10分钟
|
||||
@Scheduled(fixedRate = 600000) // 600000毫秒 = 10分钟
|
||||
public void saveData() {
|
||||
try {
|
||||
RtkData currentData = latestData.get();
|
||||
@ -259,7 +259,7 @@ public class TcpRtkServer implements CommandLineRunner {
|
||||
|
||||
// 检查是否需要保存(距离上次保存超过10分钟)
|
||||
if (lastSaveTime == null ||
|
||||
ChronoUnit.MINUTES.between(lastSaveTime, now) >= 1) { // 调试时设为1分钟,实际使用时改为10
|
||||
ChronoUnit.MINUTES.between(lastSaveTime, now) >= 10) {
|
||||
|
||||
rtkDataRepository.save(currentData);
|
||||
lastSaveTime = now;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user