Skip to content
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

optimize:移除两处冗余的代码 + refactor:优化代码组织结构 #158

Merged
merged 5 commits into from
Apr 12, 2022

Conversation

AkkiaS7
Copy link
Member

@AkkiaS7 AkkiaS7 commented Apr 12, 2022

crIgnoreMap变量 在 dashboard/main.go 中初始化后未实际使用

                crIgnoreMap := make(map[uint64]bool)
		for j := 0; j < len(cr.Servers); j++ {
			crIgnoreMap[cr.Servers[j]] = true
		} 

monitors变量 在 singleton/servicesentinel.go 中被重复初始化
(L45 monitors: make(map[uint64]*model.Monitor))
(L152 ss.monitors = make(map[uint64]*model.Monitor))

大幅缩减了 dashboard/main.go 文件长度并提高其可读性

  1. 将Cron相关代码分离到新文件并重构Init与Load函数
  2. 将Server相关代码分离到新文件并重构Init与Load函数
  3. 将gprc端口默认值设置移动到config Read时(与原先的设置默认主题放在一起)
  4. 将工具类代码分离到新文件
  5. 重构了singleton相关的Init与Load函数 现在它们有了更清晰的逻辑

没有对singleton的实际业务做出改变
已在本地对所有涉及到的功能进行测试

cmd/agent/monitor/myip.go Outdated Show resolved Hide resolved
@naiba
Copy link
Member

naiba commented Apr 12, 2022

搞得不错火鸡

@naiba naiba merged commit c8933e7 into nezhahq:master Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants