-
Notifications
You must be signed in to change notification settings - Fork 60
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
Cache config value to optimize Get config API #151
base: master
Are you sure you want to change the base?
Conversation
43bf549
to
ad88741
Compare
先把圈复杂度的检查去掉吧,这个工具肯定又出问题了
|
|
||
func createFile(content string, name string, dir string) string { | ||
filename := filepath.Join(dir, name) | ||
f1, _ := os.Create(filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go的UT已经支持临时目录特性了,不需要再这么创建,可以参考下,少维护一些代码
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go 1.13 不支持 t.TempDir ,我们需要支持 go 1.13, 这个不改吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
出自 https://go.dev/doc/devel/release
go的版本策略,为了你们的安全考虑,我不建议使用低于1.5及以下的版本,没有安全保障
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
实际的业务不可能是跟着 go 官方的节奏走,总会有一些版本比较落后。就算业务有意愿,各种三方库也有大量跟不上的。而且这里的并不需要做多大的修改,就能够都支持到的,何苦一定要改呢
得删掉这部分,门禁才能过 |
source/manager.go
Outdated
} else { | ||
m.ConfigurationMap.Store(e.Key, source.GetSourceName()) | ||
srcName := source.GetSourceName() | ||
// fixme: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个看上去改变了程序过去的行为。可否用过archaius框架级的bool作为功能开关,控制get时是否从缓存取值
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
考虑用特性分支管理
上回提到事件更新行为一直都有不能保证最终一致的问题 在目前的 master 上,(加上 mem source 的 Delete 修改) 运行 consistencytest, 可以比较容易复现配置无法保证最终一致的问题. 在修改了 updateEvent 机制的 feature/cache-config-value 分支上, consistencytest 可以 pass master 上的失败信息
|
cyclo检查失败了,把这个检查步骤干掉吧 |
我删掉了 cyclo , 再看看? |
可以推送到新的banch vx.x.x.beta |
读配置的过程, 前后要经过好多次锁,而且会受 source 实现影响。改为直接缓存当前的配置值,读取时从当前缓存读。
修改前:
修改后: