Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Oct 16, 2024
1 parent 8fef7af commit 3116bb7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 2 additions & 6 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,10 @@ func (k *serviceModeKeeper) close() {
defer k.Unlock()
switch k.serviceMode {
case pdpb.ServiceMode_API_SVC_MODE:
if k.tsoSvcDiscovery != nil {
k.tsoSvcDiscovery.Close()
}
k.tsoSvcDiscovery.Close()
fallthrough
case pdpb.ServiceMode_PD_SVC_MODE:
if k.tsoClient != nil {
k.tsoClient.close()
}
k.tsoClient.close()
case pdpb.ServiceMode_UNKNOWN_SVC_MODE:
}
}
Expand Down
3 changes: 3 additions & 0 deletions client/pd_service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ func (c *pdServiceDiscovery) checkFollowerHealth(ctx context.Context) {

// Close releases all resources.
func (c *pdServiceDiscovery) Close() {
if c == nil {
return
}
c.closeOnce.Do(func() {
log.Info("[pd] close pd service discovery client")
c.clientConns.Range(func(key, cc any) bool {
Expand Down
3 changes: 3 additions & 0 deletions client/tso_service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ func (c *tsoServiceDiscovery) retry(

// Close releases all resources
func (c *tsoServiceDiscovery) Close() {
if c == nil {
return
}
log.Info("closing tso service discovery")

c.cancel()
Expand Down

0 comments on commit 3116bb7

Please sign in to comment.