This commit is contained in:
2025-11-07 14:50:40 +08:00
parent 3a71725d23
commit ea29e2c551

View File

@@ -28,7 +28,7 @@ public class TencentDocBatchPushServiceImpl implements ITencentDocBatchPushServi
private RedisCache redisCache;
private static final String DELAYED_PUSH_TASK_KEY = "tendoc:delayed_push:task_scheduled";
private static final String DELAYED_PUSH_SCHEDULE_TIME_KEY = "tendoc:delayed_push:schedule_time";
private static final String DELAYED_PUSH_SCHEDULE_TIME_KEY = "tendoc:delayed_push:next_time";
@Override
public String createBatchPushRecord(String fileId, String sheetId, String pushType,
@@ -122,13 +122,14 @@ public class TencentDocBatchPushServiceImpl implements ITencentDocBatchPushServi
public Map<String, Object> getPushStatusAndCountdown() {
Map<String, Object> result = new HashMap<>();
// 检查是否有定时任务
Boolean isScheduled = redisCache.getCacheObject(DELAYED_PUSH_TASK_KEY);
// 检查是否有定时任务(通过时间戳是否存在来判断)
Long scheduleTime = redisCache.getCacheObject(DELAYED_PUSH_SCHEDULE_TIME_KEY);
result.put("isScheduled", isScheduled != null && isScheduled);
// 如果有推送时间戳,就认为有定时任务
boolean isScheduled = scheduleTime != null;
result.put("isScheduled", isScheduled);
if (isScheduled != null && isScheduled && scheduleTime != null) {
if (isScheduled && scheduleTime != null) {
long now = System.currentTimeMillis();
long remainingMs = scheduleTime - now;