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.AllArgsConstructor;
 | 
				
			||||||
import lombok.Getter;
 | 
					import lombok.Getter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.function.Supplier;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author www.byteblogs.com
 | 
					 * @author www.byteblogs.com
 | 
				
			||||||
 * @date 2023-06-04
 | 
					 * @date 2023-06-04
 | 
				
			||||||
@ -13,9 +15,10 @@ import lombok.Getter;
 | 
				
			|||||||
@AllArgsConstructor
 | 
					@AllArgsConstructor
 | 
				
			||||||
@Getter
 | 
					@Getter
 | 
				
			||||||
public enum TaskTypeEnum {
 | 
					public enum TaskTypeEnum {
 | 
				
			||||||
    RETRY(1, ActorGenerator.scanGroupActor()),
 | 
					    RETRY(1, ActorGenerator::scanGroupActor),
 | 
				
			||||||
    CALLBACK(2, ActorGenerator.scanCallbackGroupActor());
 | 
					    CALLBACK(2, ActorGenerator::scanCallbackGroupActor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Integer type;
 | 
					    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.Collections;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -65,6 +66,10 @@ public class MybatisConfigAccess extends AbstractConfigAccess {
 | 
				
			|||||||
        LambdaQueryWrapper<SceneConfig> sceneConfigLambdaQueryWrapper = new LambdaQueryWrapper<SceneConfig>()
 | 
					        LambdaQueryWrapper<SceneConfig> sceneConfigLambdaQueryWrapper = new LambdaQueryWrapper<SceneConfig>()
 | 
				
			||||||
          .eq(SceneConfig::getSceneName, groupName);
 | 
					          .eq(SceneConfig::getSceneName, groupName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (Objects.isNull(groupConfig)) {
 | 
				
			||||||
 | 
					            return Collections.EMPTY_SET;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (StatusEnum.YES.getStatus().equals(groupConfig.getGroupStatus())) {
 | 
					        if (StatusEnum.YES.getStatus().equals(groupConfig.getGroupStatus())) {
 | 
				
			||||||
            sceneConfigLambdaQueryWrapper.eq(SceneConfig::getSceneStatus, StatusEnum.NO.getStatus());
 | 
					            sceneConfigLambdaQueryWrapper.eq(SceneConfig::getSceneStatus, StatusEnum.NO.getStatus());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -134,7 +134,7 @@ public class DispatchService implements Lifecycle {
 | 
				
			|||||||
    private ActorRef cacheActorRef(String groupName, TaskTypeEnum typeEnum) {
 | 
					    private ActorRef cacheActorRef(String groupName, TaskTypeEnum typeEnum) {
 | 
				
			||||||
        ActorRef scanActorRef = CacheGroupScanActor.get(groupName, typeEnum);
 | 
					        ActorRef scanActorRef = CacheGroupScanActor.get(groupName, typeEnum);
 | 
				
			||||||
        if (Objects.isNull(scanActorRef)) {
 | 
					        if (Objects.isNull(scanActorRef)) {
 | 
				
			||||||
            scanActorRef = typeEnum.getActorRef();
 | 
					            scanActorRef = typeEnum.getActorRef().get();
 | 
				
			||||||
            // 缓存扫描器actor
 | 
					            // 缓存扫描器actor
 | 
				
			||||||
            CacheGroupScanActor.put(groupName, typeEnum, scanActorRef);
 | 
					            CacheGroupScanActor.put(groupName, typeEnum, scanActorRef);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -40,6 +40,9 @@ public class RetryExecutor<V> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        for (FilterStrategy filterStrategy : filterStrategies) {
 | 
					        for (FilterStrategy filterStrategy : filterStrategies) {
 | 
				
			||||||
            if (!filterStrategy.filter(retryContext)) {
 | 
					            if (!filterStrategy.filter(retryContext)) {
 | 
				
			||||||
 | 
					                log.warn("当前任务不满足执行条件. groupName:[{}] uniqueId:[{}], filter:[{}]",
 | 
				
			||||||
 | 
					                    retryContext.getRetryTask().getGroupName(),
 | 
				
			||||||
 | 
					                    retryContext.getRetryTask().getUniqueId(), filterStrategy.getClass().getName());
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user