Commit d0bbf8ad by 李根

修复dashboard重启之后,新添加的规则会替换掉老规则的bug

parent 155c6b3b
...@@ -5,3 +5,5 @@ target\ ...@@ -5,3 +5,5 @@ target\
sentinel-dashboard-plus.iml sentinel-dashboard-plus.iml
application-dev.yml application-dev.yml
application-dev.properties application-dev.properties
application-dev.yml
application-dev.properties
...@@ -188,10 +188,10 @@ public class FlowControllerV2 { ...@@ -188,10 +188,10 @@ public class FlowControllerV2 {
entity.setGmtCreate(oldEntity.getGmtCreate()); entity.setGmtCreate(oldEntity.getGmtCreate());
entity.setGmtModified(date); entity.setGmtModified(date);
try { try {
entity = repository.save(entity); // entity = repository.save(entity);
if (entity == null) { // if (entity == null) {
return Result.ofFail(-1, "save entity fail"); // return Result.ofFail(-1, "save entity fail");
} // }
publishRules(oldEntity.getApp()); publishRules(oldEntity.getApp());
} catch (Throwable throwable) { } catch (Throwable throwable) {
logger.error("Failed to update flow rule", throwable); logger.error("Failed to update flow rule", throwable);
......
...@@ -36,4 +36,14 @@ public class InMemApiDefinitionStore extends InMemoryRuleRepositoryAdapter<ApiDe ...@@ -36,4 +36,14 @@ public class InMemApiDefinitionStore extends InMemoryRuleRepositoryAdapter<ApiDe
protected long nextId() { protected long nextId() {
return ids.incrementAndGet(); return ids.incrementAndGet();
} }
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
} }
...@@ -36,4 +36,14 @@ public class InMemGatewayFlowRuleStore extends InMemoryRuleRepositoryAdapter<Gat ...@@ -36,4 +36,14 @@ public class InMemGatewayFlowRuleStore extends InMemoryRuleRepositoryAdapter<Gat
protected long nextId() { protected long nextId() {
return ids.incrementAndGet(); return ids.incrementAndGet();
} }
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
} }
...@@ -36,4 +36,14 @@ public class InMemAuthorityRuleStore extends InMemoryRuleRepositoryAdapter<Autho ...@@ -36,4 +36,14 @@ public class InMemAuthorityRuleStore extends InMemoryRuleRepositoryAdapter<Autho
protected long nextId() { protected long nextId() {
return ids.incrementAndGet(); return ids.incrementAndGet();
} }
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
} }
...@@ -33,4 +33,14 @@ public class InMemDegradeRuleStore extends InMemoryRuleRepositoryAdapter<Degrade ...@@ -33,4 +33,14 @@ public class InMemDegradeRuleStore extends InMemoryRuleRepositoryAdapter<Degrade
protected long nextId() { protected long nextId() {
return ids.incrementAndGet(); return ids.incrementAndGet();
} }
@Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
} }
...@@ -38,6 +38,11 @@ public class InMemFlowRuleStore extends InMemoryRuleRepositoryAdapter<FlowRuleEn ...@@ -38,6 +38,11 @@ public class InMemFlowRuleStore extends InMemoryRuleRepositoryAdapter<FlowRuleEn
} }
@Override @Override
protected void clearId() {
ids.set(0);
}
@Override
protected FlowRuleEntity preProcess(FlowRuleEntity entity) { protected FlowRuleEntity preProcess(FlowRuleEntity entity) {
if (entity != null && entity.isClusterMode()) { if (entity != null && entity.isClusterMode()) {
ClusterFlowConfig config = entity.getClusterConfig(); ClusterFlowConfig config = entity.getClusterConfig();
...@@ -50,4 +55,9 @@ public class InMemFlowRuleStore extends InMemoryRuleRepositoryAdapter<FlowRuleEn ...@@ -50,4 +55,9 @@ public class InMemFlowRuleStore extends InMemoryRuleRepositoryAdapter<FlowRuleEn
} }
return entity; return entity;
} }
@Override
protected void setId(long id) {
ids.set(id);
}
} }
...@@ -37,6 +37,16 @@ public class InMemParamFlowRuleStore extends InMemoryRuleRepositoryAdapter<Param ...@@ -37,6 +37,16 @@ public class InMemParamFlowRuleStore extends InMemoryRuleRepositoryAdapter<Param
} }
@Override @Override
protected void clearId() {
ids.set(0);
}
@Override
protected void setId(long id) {
ids.set(id);
}
@Override
protected ParamFlowRuleEntity preProcess(ParamFlowRuleEntity entity) { protected ParamFlowRuleEntity preProcess(ParamFlowRuleEntity entity) {
if (entity != null && entity.isClusterMode()) { if (entity != null && entity.isClusterMode()) {
ParamFlowClusterConfig config = entity.getClusterConfig(); ParamFlowClusterConfig config = entity.getClusterConfig();
......
...@@ -33,4 +33,14 @@ public class InMemSystemRuleStore extends InMemoryRuleRepositoryAdapter<SystemRu ...@@ -33,4 +33,14 @@ public class InMemSystemRuleStore extends InMemoryRuleRepositoryAdapter<SystemRu
protected long nextId() { protected long nextId() {
return ids.incrementAndGet(); return ids.incrementAndGet();
} }
@Override
protected void setId(long id) {
ids.set(id);
}
@Override
protected void clearId() {
ids.set(0);
}
} }
...@@ -5,7 +5,7 @@ spring: ...@@ -5,7 +5,7 @@ spring:
mongodb: mongodb:
port: 27017 port: 27017
database: db1 database: db1
uri: mongodb://lg:123456@118.25.153.63 uri: mongodb://lg:123456@xx.xx.xx.xx
authentication-database: admin authentication-database: admin
http: http:
encoding: encoding:
...@@ -34,7 +34,7 @@ auth: ...@@ -34,7 +34,7 @@ auth:
nacos: nacos:
degradeDataIdPrefix: degrade-rules degradeDataIdPrefix: degrade-rules
serverAddr: 10.16.10.139 serverAddr: xx.xx.xx.xx
groupId: DEFAULT_GROUP groupId: DEFAULT_GROUP
flowDataIdPrefix: flow-rules flowDataIdPrefix: flow-rules
namespace: 31b168cb-51ee-4b8b-adfa-29b42d4afa0b namespace: 31b168cb-51ee-4b8b-adfa-29b42d4afa0b
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<ul class="nav nav-second-level" ng-show="entry.active"> <ul class="nav nav-second-level" ng-show="entry.active">
<li ui-sref-active="active"> <li ui-sref-active="active">
<a ui-sref="dashboard.metric({app: entry.app})"> <a ui-sref="dashboard.metric({app: entry.app})">
<i class="fa fa-bar-chart"></i>&nbsp;&nbsp;实时监控11</a> <i class="fa fa-bar-chart"></i>&nbsp;&nbsp;实时监控</a>
</li> </li>
<li ui-sref-active="active" ng-if="!entry.isGateway"> <li ui-sref-active="active" ng-if="!entry.isGateway">
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment