fix: 2.0.2
1. 修复没有配置组时获取场景黑名单NPE问题 2. 修复不同组的ScanActor对象相同问题
This commit is contained in:
		
							parent
							
								
									421c71dbbc
								
							
						
					
					
						commit
						edfe815d5a
					
				@ -5,6 +5,8 @@ import com.aizuda.easy.retry.server.akka.ActorGenerator;
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import lombok.Getter;
 | 
			
		||||
 | 
			
		||||
import java.util.function.Supplier;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author www.byteblogs.com
 | 
			
		||||
 * @date 2023-06-04
 | 
			
		||||
@ -13,9 +15,10 @@ import lombok.Getter;
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
@Getter
 | 
			
		||||
public enum TaskTypeEnum {
 | 
			
		||||
    RETRY(1, ActorGenerator.scanGroupActor()),
 | 
			
		||||
    CALLBACK(2, ActorGenerator.scanCallbackGroupActor());
 | 
			
		||||
    RETRY(1, ActorGenerator::scanGroupActor),
 | 
			
		||||
    CALLBACK(2, ActorGenerator::scanCallbackGroupActor);
 | 
			
		||||
 | 
			
		||||
    private final Integer type;
 | 
			
		||||
    private final ActorRef actorRef;
 | 
			
		||||
    private final Supplier<ActorRef> actorRef;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@ import org.springframework.util.CollectionUtils;
 | 
			
		||||
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
@ -65,6 +66,10 @@ public class MybatisConfigAccess extends AbstractConfigAccess {
 | 
			
		||||
        LambdaQueryWrapper<SceneConfig> sceneConfigLambdaQueryWrapper = new LambdaQueryWrapper<SceneConfig>()
 | 
			
		||||
          .eq(SceneConfig::getSceneName, groupName);
 | 
			
		||||
 | 
			
		||||
        if (Objects.isNull(groupConfig)) {
 | 
			
		||||
            return Collections.EMPTY_SET;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (StatusEnum.YES.getStatus().equals(groupConfig.getGroupStatus())) {
 | 
			
		||||
            sceneConfigLambdaQueryWrapper.eq(SceneConfig::getSceneStatus, StatusEnum.NO.getStatus());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -134,7 +134,7 @@ public class DispatchService implements Lifecycle {
 | 
			
		||||
    private ActorRef cacheActorRef(String groupName, TaskTypeEnum typeEnum) {
 | 
			
		||||
        ActorRef scanActorRef = CacheGroupScanActor.get(groupName, typeEnum);
 | 
			
		||||
        if (Objects.isNull(scanActorRef)) {
 | 
			
		||||
            scanActorRef = typeEnum.getActorRef();
 | 
			
		||||
            scanActorRef = typeEnum.getActorRef().get();
 | 
			
		||||
            // 缓存扫描器actor
 | 
			
		||||
            CacheGroupScanActor.put(groupName, typeEnum, scanActorRef);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -40,6 +40,9 @@ public class RetryExecutor<V> {
 | 
			
		||||
 | 
			
		||||
        for (FilterStrategy filterStrategy : filterStrategies) {
 | 
			
		||||
            if (!filterStrategy.filter(retryContext)) {
 | 
			
		||||
                log.warn("当前任务不满足执行条件. groupName:[{}] uniqueId:[{}], filter:[{}]",
 | 
			
		||||
                    retryContext.getRetryTask().getGroupName(),
 | 
			
		||||
                    retryContext.getRetryTask().getUniqueId(), filterStrategy.getClass().getName());
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user