Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public void run() {
try {
// 任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
Date losedTime = DateUtil.addMinutes(new Date(), -10);
List<Long> losedJobIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);
Date fromTime = DateUtil.addMinutes(new Date(), -20);
//缩小时间范围,减少查询范围,挑选从20分钟前到10分钟前的任务来查询,因为每间隔1分钟已经检查过一次。
List<Long> losedJobIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime, fromTime);

if (losedJobIds!=null && losedJobIds.size()>0) {
for (Long logId: losedJobIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ public int updateAlarmStatus(@Param("logId") long logId,
@Param("oldAlarmStatus") int oldAlarmStatus,
@Param("newAlarmStatus") int newAlarmStatus);

public List<Long> findLostJobIds(@Param("losedTime") Date losedTime);
public List<Long> findLostJobIds(@Param("losedTime") Date losedTime, @Param("fromTime") Date fromTime);

}
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
t.trigger_code = 200
AND t.handle_code = 0
AND t.trigger_time <![CDATA[ <= ]]> #{losedTime}
AND t.trigger_time <![CDATA[ >= ]]> #{fromTime}
AND t2.id IS NULL;
</select>
<!--
Expand Down