feat(1.3.0-beta2): 修复https://gitee.com/aizuda/snail-job/issues/IBHA4U
This commit is contained in:
		
							parent
							
								
									821e7fb659
								
							
						
					
					
						commit
						04bd145e09
					
				@ -1,12 +1,11 @@
 | 
				
			|||||||
package com.aizuda.snailjob.server.retry.task.dto;
 | 
					package com.aizuda.snailjob.server.retry.task.dto;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.aizuda.snailjob.template.datasource.persistence.po.CreateUpdateDt;
 | 
					 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class RetryTaskExecutorDTO extends CreateUpdateDt {
 | 
					public class RetryTaskExecutorDTO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Long id;
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -40,4 +39,8 @@ public class RetryTaskExecutorDTO extends CreateUpdateDt {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private String reason;
 | 
					    private String reason;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private LocalDateTime updateDt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private LocalDateTime createDt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
package com.aizuda.snailjob.server.retry.task.dto;
 | 
					package com.aizuda.snailjob.server.retry.task.dto;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.aizuda.snailjob.template.datasource.persistence.po.CreateUpdateDt;
 | 
					 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
@ -11,7 +10,7 @@ import java.time.LocalDateTime;
 | 
				
			|||||||
 * @date 2024/12/23
 | 
					 * @date 2024/12/23
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class RetryTaskFailAlarmEventDTO extends CreateUpdateDt {
 | 
					public class RetryTaskFailAlarmEventDTO {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Long id;
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -57,6 +57,7 @@ public class FailureActor extends AbstractActor {
 | 
				
			|||||||
        return receiveBuilder().match(RetryTaskExecutorDTO.class, retryTaskExecutorDTO -> {
 | 
					        return receiveBuilder().match(RetryTaskExecutorDTO.class, retryTaskExecutorDTO -> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            SnailJobLog.LOCAL.debug("FailureActor params:[{}]", retryTaskExecutorDTO);
 | 
					            SnailJobLog.LOCAL.debug("FailureActor params:[{}]", retryTaskExecutorDTO);
 | 
				
			||||||
 | 
					            // 这里先这样后面重构统一调整
 | 
				
			||||||
            RetryTask retryTask = RetryTaskConverter.INSTANCE.toRetryTask(retryTaskExecutorDTO);
 | 
					            RetryTask retryTask = RetryTaskConverter.INSTANCE.toRetryTask(retryTaskExecutorDTO);
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                // 超过最大等级
 | 
					                // 超过最大等级
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@ package com.aizuda.snailjob.server.retry.task.support.retry;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import akka.actor.ActorRef;
 | 
					import akka.actor.ActorRef;
 | 
				
			||||||
import cn.hutool.core.lang.Pair;
 | 
					import cn.hutool.core.lang.Pair;
 | 
				
			||||||
 | 
					import cn.hutool.core.util.StrUtil;
 | 
				
			||||||
import com.aizuda.snailjob.client.model.DispatchRetryResultDTO;
 | 
					import com.aizuda.snailjob.client.model.DispatchRetryResultDTO;
 | 
				
			||||||
import com.aizuda.snailjob.common.core.enums.RetryNotifySceneEnum;
 | 
					import com.aizuda.snailjob.common.core.enums.RetryNotifySceneEnum;
 | 
				
			||||||
import com.aizuda.snailjob.common.core.model.Result;
 | 
					import com.aizuda.snailjob.common.core.model.Result;
 | 
				
			||||||
@ -18,6 +19,7 @@ import com.aizuda.snailjob.server.retry.task.support.StopStrategy;
 | 
				
			|||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
import java.util.concurrent.Callable;
 | 
					import java.util.concurrent.Callable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -98,10 +100,29 @@ public class RetryExecutor<V> {
 | 
				
			|||||||
            actorRef = ActorGenerator.failureActor();
 | 
					            actorRef = ActorGenerator.failureActor();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 获取失败原因
 | 
				
			||||||
 | 
					        String reason = StrUtil.EMPTY;
 | 
				
			||||||
 | 
					        if (retryContext.hasException()) {
 | 
				
			||||||
 | 
					            Exception exception = retryContext.getException();
 | 
				
			||||||
 | 
					            if (Objects.nonNull(exception)) {
 | 
				
			||||||
 | 
					                reason = exception.getCause().getMessage();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            if (Objects.nonNull(call)) {
 | 
				
			||||||
 | 
					                Result<DispatchRetryResultDTO> result = (Result<DispatchRetryResultDTO>) call;
 | 
				
			||||||
 | 
					                DispatchRetryResultDTO data = result.getData();
 | 
				
			||||||
 | 
					                if (StrUtil.isBlank(result.getMessage()) && Objects.nonNull(data)) {
 | 
				
			||||||
 | 
					                    reason = data.getExceptionMsg();
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    reason = result.getMessage();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        RetryTaskExecutorDTO retryTaskExecutorDTO =
 | 
					        RetryTaskExecutorDTO retryTaskExecutorDTO =
 | 
				
			||||||
                RetryTaskConverter.INSTANCE.toRetryTaskExecutorDTO(
 | 
					                RetryTaskConverter.INSTANCE.toRetryTaskExecutorDTO(
 | 
				
			||||||
                        retryContext.getRetryTask(),
 | 
					                        retryContext.getRetryTask(), reason,
 | 
				
			||||||
                        retryContext.hasException() ? retryContext.getException().getCause().getMessage() : ((DispatchRetryResultDTO) ((Result) call).getData()).getExceptionMsg(),
 | 
					 | 
				
			||||||
                        RetryNotifySceneEnum.RETRY_TASK_FAIL_ERROR.getNotifyScene());
 | 
					                        RetryNotifySceneEnum.RETRY_TASK_FAIL_ERROR.getNotifyScene());
 | 
				
			||||||
        actorRef.tell(retryTaskExecutorDTO, actorRef);
 | 
					        actorRef.tell(retryTaskExecutorDTO, actorRef);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user