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-unsubscr...@inlong.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to