From 4eaa182e59d8ec21c97943a6fcbc627834cbabc2 Mon Sep 17 00:00:00 2001 From: JmPotato Date: Thu, 25 Apr 2024 11:24:02 +0800 Subject: [PATCH] Refine the comments Signed-off-by: JmPotato --- client/tso_client.go | 4 ++-- client/tso_dispatcher.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/tso_client.go b/client/tso_client.go index 20d1fc19583b..550d302bcf64 100644 --- a/client/tso_client.go +++ b/client/tso_client.go @@ -353,9 +353,9 @@ func (c *tsoClient) tryConnectToTSO( url string cc *grpc.ClientConn updateAndClear = func(newURL string, connectionCtx *tsoConnectionContext) { - // Only store the connectionCtx if it does not exist before. + // Only store the `connectionCtx` if it does not exist before. connectionCtxs.LoadOrStore(newURL, connectionCtx) - // Remove all other connection contexts. + // Remove all other `connectionCtx`s. connectionCtxs.Range(func(url, cc any) bool { if url.(string) != newURL { cc.(*tsoConnectionContext).cancel() diff --git a/client/tso_dispatcher.go b/client/tso_dispatcher.go index 2e6b9babd73c..9fc7596b2368 100644 --- a/client/tso_dispatcher.go +++ b/client/tso_dispatcher.go @@ -122,8 +122,8 @@ func (c *tsoClient) updateTSODispatcher() { } if _, exist := c.GetTSOAllocators().Load(dcLocation); !exist { log.Info("[tso] delete unused tso dispatcher", zap.String("dc-location", dcLocation)) - dispatcher.(*tsoDispatcher).close() c.tsoDispatcher.Delete(dcLocation) + dispatcher.(*tsoDispatcher).close() } return true }) @@ -335,7 +335,7 @@ func (c *tsoClient) handleDispatcher( tbc.clear() c.wg.Done() }() - // Daemon goroutine to update the connectionCtxs periodically and handle the TSO Follower Proxy switch event. + // Daemon goroutine to update the connectionCtxs periodically and handle the `connectionCtxs` update event. go func() { var updateTicker = &time.Ticker{} setNewUpdateTicker := func(ticker *time.Ticker) {