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

自发现的goroutine 没有做退出控制,依赖于main的退出 #72

Open
KelvinChen684 opened this issue Dec 4, 2020 · 3 comments

Comments

@KelvinChen684
Copy link

go d.nodesproc()

func (d *Discovery) nodesproc() {
for {
// 中间无退出控制
// 会产生野生goroutine
}
}

@0XFF-96
Copy link

0XFF-96 commented Jan 13, 2021

这里貌似没有做管理 goroutine 生命周期的工作

@xvrzhao
Copy link

xvrzhao commented Feb 7, 2021

这里可以参考 micro-stacks/discov 的设计。

@yeqown
Copy link

yeqown commented Apr 7, 2021

按照我的理解:自发现就是持续进行的工作,就应该和main的生命周期一致才对吧?要不然怎么覆盖discovery的扩容和缩容场景?但是其中有一段代码不是很理解:

}
apps := <-ch
ins, ok := apps[model.AppID]
if !ok || ins == nil {
return
}

在收到节点变更通知,但是其中为空就会导致自发现退出,那自发现就不用继续进行了吗?虽然这个情况并不常见,但一旦出现那么discovery 是不是就不能正常感知节点变化了?

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

No branches or pull requests

4 participants