nacos
nacos copied to clipboard
Optimize checkLocalConfig logic
Please do not create a Pull Request without creating an issue first.
What is the purpose of the change
issue:https://github.com/alibaba/nacos/issues/11866
Brief changelog
XX
Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [ ] Format the pull request title like
[ISSUE #123] Fix UnknownException when host config not exist
. Each commit in the pull request should have a meaningful subject line and body. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
- [ ] Run
mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true
to make sure basic checks pass. Runmvn clean install -DskipITs
to make sure unit-test pass. Runmvn clean test-compile failsafe:integration-test
to make sure integration-test pass.
LGTM
Please sign CLA first.
Please sign CLA first.
done
The PR title may need to be updated to English.
fix checkstyle pls.
我重新读了一下逻辑, 这个重构后的逻辑颠覆了之前的设计理念。
之前之所以不使用变量,是为了在获取failover后, 再次进行文件存在的校验,换句话说进行了至少2次的文件存在校验。
而重构后的逻辑,只进行了一次校验,同时时间上也不太正确。
原: 是否存在 -》 存在读取 -〉 再次校验-》存在则使用,不存在则不使用。 新: 是否存在 -〉 是否删除 -> 存在读取 -> 删除则不使用。
这可能导致某些极端情况下和之前的客户端会有不同的行为, 我的建议是把校验逻辑和通用逻辑抽象成方法, 而不是只用变量存储,并且不建议修改顺序。
好的,考虑的好细致,感谢提醒
@KomachiSion 请问这个pr合并之前还有什么我需要改动的吗
CICD通过的话就可以合并了
CICD通过的话就可以合并了
现在应该通过了?
CICD通过的话就可以合并了
hi,麻烦帮忙合并一下? @KomachiSion