This commit is contained in:
houxinyu
2023-07-15 19:54:33 +08:00
parent 414b3503a5
commit 8db6cef414
4 changed files with 7 additions and 8 deletions

View File

@@ -87,7 +87,7 @@ public class ChainPollingTask {
//在此处重新拉取所有chainId集合,补充添加新chain
Set<String> newChainSet = chainJedis.hkeys(chainKey);
for (String chainId : newChainSet) {
if (chainSHAMap.get(chainId) == null) {
if (!chainSHAMap.containsKey(chainId)) {
//将新chainId添加到LiteFlowChainELBuilder和SHAMap
String chainData = chainJedis.hget(chainKey, chainId);
LiteFlowChainELBuilder.createChain().setChainId(chainId).setEL(chainData).build();

View File

@@ -191,7 +191,7 @@ public class RedisParserPollingMode implements RedisParserHelper {
//添加轮询chain的定时任务
ChainPollingTask chainTask = new ChainPollingTask(redisParserVO, chainJedis, chainNum, chainSHAMap, LOG);
pool.scheduleAtFixedRate(chainTask.pollChainTask(keyLuaOfChain, valueLuaOfChain),
60, Long.parseLong(redisParserVO.getPollingInterval()), TimeUnit.SECONDS);
60, redisParserVO.getPollingInterval().longValue(), TimeUnit.SECONDS);
//如果有脚本
if (ObjectUtil.isNotNull(scriptJedis) && ObjectUtil.isNotNull(redisParserVO.getScriptDataBase())
@@ -203,7 +203,7 @@ public class RedisParserPollingMode implements RedisParserHelper {
//添加轮询script的定时任务
ScriptPollingTask scriptTask = new ScriptPollingTask(redisParserVO, scriptJedis, scriptNum, scriptSHAMap, LOG);
pool.scheduleAtFixedRate(scriptTask.pollScriptTask(keyLuaOfScript, valueLuaOfScript),
60, Long.parseLong(redisParserVO.getPollingInterval()), TimeUnit.SECONDS);
60, redisParserVO.getPollingInterval().longValue(), TimeUnit.SECONDS);
}
}
}

View File

@@ -86,7 +86,7 @@ public class ScriptPollingTask {
//在此处重新拉取所有script名集合,补充添加新script
Set<String> newScriptSet = scriptJedis.hkeys(scriptKey);
for (String scriptFieldValue : newScriptSet) {
if (scriptSHAMap.get(scriptFieldValue) == null) {
if (!scriptSHAMap.containsKey(scriptFieldValue)) {
//将新script添加到LiteFlowChainELBuilder和SHAMap
String scriptData = scriptJedis.hget(scriptKey, scriptFieldValue);
RedisParserHelper.changeScriptNode(scriptFieldValue, scriptData);

View File

@@ -24,8 +24,7 @@ public class RedisParserVO {
private RedisParserMode mode = RedisParserMode.POLL;
/*轮询时间间隔(s) 默认1分钟 若选择订阅机制可不配置*/
//todo 确定类型是string还是long,若为string需校验
private String pollingInterval = "60";
private Integer pollingInterval = 60;
/*chain表配置的数据库号*/
private Integer chainDataBase;
@@ -78,11 +77,11 @@ public class RedisParserVO {
}
}
public String getPollingInterval() {
public Integer getPollingInterval() {
return pollingInterval;
}
public void setPollingInterval(String pollingInterval) {
public void setPollingInterval(Integer pollingInterval) {
this.pollingInterval = pollingInterval;
}