You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@inlong.apache.org by "gunli (via GitHub)" <gi...@apache.org> on 2025/01/23 07:11:17 UTC
[I] [Improve][SDK] Delete redundant default case in the discoverer of Golang SDK [inlong]
gunli opened a new issue, #11709:
URL: https://github.com/apache/inlong/issues/11709
### Description
```go
func (d *dataProxyDiscoverer) update() {
wg := sync.WaitGroup{}
ticker := time.NewTicker(d.lookupInterval)
stopCh := make(chan struct{})
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case <-ticker.C:
d.lookup()
case <-stopCh:
return
default:
time.Sleep(500 * time.Millisecond)
}
}
}()
d.closeFunc = func() {
ticker.Stop()
close(stopCh)
wg.Wait()
}
}
func (d *dnsDiscoverer) update() {
wg := sync.WaitGroup{}
ticker := time.NewTicker(d.lookupInterval)
stopCh := make(chan struct{})
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case <-ticker.C:
d.lookup()
case <-stopCh:
return
default:
time.Sleep(500 * time.Millisecond)
}
}
}()
d.closeFunc = func() {
ticker.Stop()
close(stopCh)
wg.Wait()
}
}
```
The default cases in these 2 methods are redundant, they will increase the CPU usage, they should delete.
### InLong Component
InLong SDK
### Are you willing to submit PR?
- [x] Yes, I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@inlong.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][SDK] Delete redundant default case in the discoverer of Golang SDK [inlong]
Posted by "dockerzhang (via GitHub)" <gi...@apache.org>.
dockerzhang closed issue #11709: [Improve][SDK] Delete redundant default case in the discoverer of Golang SDK
URL: https://github.com/apache/inlong/issues/11709
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org