-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sentinel自行持久化后的一个bug,会导致新增的各类规则把持久数据源加载出来的规则冲掉 #1868
Comments
其实我一直建议直接在app端同时集成read/write数据源,直接通过原生的dashboard走transport api来改,这样其实没什么改动 |
+1 |
的确是个好建议 |
InMemoryRuleRepositoryAdapter类中save方法里添加了一个判断解决了这个问题 代码如下:
|
@HuiBear 注:该 |
用nacos做的持久化,至于如何持久化的,网上一堆教程,用的push模式
但是当sentinel重启后,com.alibaba.csp.sentinel.dashboard.repository.rule下的InMemoryRuleRepositoryAdapter中的save方法
给entity赋值的时候,这里用的nextId(),而这个nextId的逻辑是下面这里:
所以会导致id直接从1开始赋新的值,而allRules这个Map又会以这个id为key进行规则的存储,导致sentinel重启后,新增的各类规则会逐步将原有规则冲掉了,需要自己修改一下这里的id生成逻辑
The text was updated successfully, but these errors were encountered: