mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
parent
4c0e5f348b
commit
c3eefeb626
@ -133,6 +133,8 @@ public class SaveJobInfoRequest {
|
||||
|
||||
private String lifecycle;
|
||||
|
||||
private Long retryInterval;
|
||||
|
||||
|
||||
/**
|
||||
* Check non-null properties.
|
||||
|
@ -81,4 +81,6 @@ public class JobInfoDTO {
|
||||
private Integer dispatchStrategy;
|
||||
|
||||
private String lifecycle;
|
||||
|
||||
private Long retryInterval;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -44,6 +45,8 @@ public class InstanceManager {
|
||||
@Resource
|
||||
private WorkflowInstanceManager workflowInstanceManager;
|
||||
|
||||
private static final long DEFAULT_RETRY_INTERVAL = 10000;
|
||||
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
@ -114,8 +117,9 @@ public class InstanceManager {
|
||||
|
||||
log.info("[InstanceManager-{}] instance execute failed but will take the {}th retry.", instanceId, instanceInfo.getRunningTimes());
|
||||
|
||||
// 延迟10S重试(由于重试不改变 instanceId,如果派发到同一台机器,上一个 TaskTracker 还处于资源释放阶段,无法创建新的TaskTracker,任务失败)
|
||||
instanceInfo.setExpectedTriggerTime(System.currentTimeMillis() + 10000);
|
||||
// 默认延迟10S重试(由于重试不改变 instanceId,如果派发到同一台机器,上一个 TaskTracker 还处于资源释放阶段,无法创建新的TaskTracker,任务失败)
|
||||
Long retryInterval = Optional.ofNullable(jobInfo.getRetryInterval()).orElse(DEFAULT_RETRY_INTERVAL);
|
||||
instanceInfo.setExpectedTriggerTime(System.currentTimeMillis() + retryInterval);
|
||||
|
||||
// 修改状态为 等待派发,正式开始重试
|
||||
// 问题:会丢失以往的调度记录(actualTriggerTime什么的都会被覆盖)
|
||||
|
@ -141,4 +141,9 @@ public class JobInfoDO {
|
||||
|
||||
private String lifecycle;
|
||||
|
||||
/**
|
||||
* 重试时间间隔
|
||||
*/
|
||||
private Long retryInterval;
|
||||
|
||||
}
|
||||
|
@ -96,6 +96,8 @@ public class JobInfoVO {
|
||||
|
||||
private String lifecycle;
|
||||
|
||||
private Long retryInterval;
|
||||
|
||||
public static JobInfoVO from(JobInfoDO jobInfoDO) {
|
||||
JobInfoVO jobInfoVO = new JobInfoVO();
|
||||
BeanUtils.copyProperties(jobInfoDO, jobInfoVO);
|
||||
|
Loading…
x
Reference in New Issue
Block a user