AlexStocks commented on PR #3252:
URL: https://github.com/apache/dubbo-go/pull/3252#issuecomment-4106487851

   ### 3. ⚠️ 静态配置与动态配置关系(部分解决)
   
   **原问题(Alanxtl & AlexStocks):** 静态注入和动态配置中心的关系不清楚,谁覆盖谁、优先级如何。
   
   **改进情况:**
   - 作者在评论中说明:静态配置在 `newRouterChain` 阶段注入作为初始化配置,动态配置会直接替代静态配置
   - `SetStaticConfig()` 添加了注释说明用于静态配置
   - `Process()` 方法处理动态配置中心更新
   
   **存在问题:**
   1. **代码层面没有优先级保护**:`Process()` 和 `SetStaticConfig()` 都直接修改 
`d.conditionRouter`,后执行的会覆盖前面的,没有任何优先级判断
   2. **注释不够明确**:`SetStaticConfig()` 的注释只说了它是静态配置入口,但没有说明与 `Process()` 的关系
   3. **文档缺失**:作者承诺会在文档中说明,但目前 PR 中没有文档
   
   **建议:**
   - 在 `SetStaticConfig()` 和 `Process()` 的注释中明确说明:"动态配置会覆盖静态配置"
   - 或者考虑添加一个标志位,记录配置来源,避免静态配置意外覆盖动态配置


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to