tianxiaoliang commented on a change in pull request #577: Clear no-instance
services automatically
URL:
https://github.com/apache/servicecomb-service-center/pull/577#discussion_r317057264
##########
File path: server/server.go
##########
@@ -128,6 +130,38 @@ func (s *ServiceCenterServer) compactBackendService() {
})
}
+// clear services who have no instance
+func (s *ServiceCenterServer) clearNoInstanceServices() {
+ if !core.ServerInfo.Config.ServiceClearEnabled {
+ return
+ }
+ log.Infof("service clear enabled, interval: %s, time: %s",
+ core.ServerInfo.Config.ServiceClearInterval,
+ core.ServerInfo.Config.ServiceClearTime)
+
+ s.goroutine.Do(func(ctx context.Context) {
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case
<-time.After(core.ServerInfo.Config.ServiceClearInterval):
+ lock, err := mux.Try(mux.SERVICE_CLEAR_LOCK)
Review comment:
you did not handler err
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services