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

only close channel once #114

Merged
merged 1 commit into from
Jun 5, 2023
Merged

Conversation

butonic
Copy link
Contributor

@butonic butonic commented Jun 5, 2023

with #113 we sometines see a panic like this:

panic: close of closed channel

goroutine 21629 [running]:
github.com/go-micro/plugins/v4/registry/kubernetes.(*k8sWatcher).Stop(0xc003e2f880)
    github.com/go-micro/plugins/v4/registry/kubernetes@v1.1.1/watcher.go:167 +0x56
go-micro.dev/v4/registry/cache.(*cache).watch.func1()
    go-micro.dev/v4@v4.9.0/registry/cache/cache.go:409 +0xe9
created by go-micro.dev/v4/registry/cache.(*cache).watch
    go-micro.dev/v4@v4.9.0/registry/cache/cache.go:403 +0xb8

I'm not proud of this solution and I tried using a Context and ContextCancel function as in the bodyWatcher, but that caused more problems than it solved. Any pointers on how to tackle this properly are welcome.

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
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