Skip to content

Commit

Permalink
Decouple tsoClient and tsoDispatcher
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <ghzpotato@gmail.com>
  • Loading branch information
JmPotato committed Apr 28, 2024
1 parent aae410f commit f2aa258
Show file tree
Hide file tree
Showing 3 changed files with 427 additions and 401 deletions.
6 changes: 3 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (k *serviceModeKeeper) 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 Expand Up @@ -651,11 +651,11 @@ func (c *client) resetTSOClientLocked(mode pdpb.ServiceMode) {
log.Warn("[pd] intend to switch to unknown service mode, just return")
return
}
newTSOCli.Setup()
newTSOCli.setup()
// Replace the old TSO client.
oldTSOClient := c.tsoClient
c.tsoClient = newTSOCli
oldTSOClient.Close()
oldTSOClient.close()
// Replace the old TSO service discovery if needed.
oldTSOSvcDiscovery := c.tsoSvcDiscovery
// If newTSOSvcDiscovery is nil, that's expected, as it means we are switching to PD service mode and
Expand Down
Loading

0 comments on commit f2aa258

Please sign in to comment.