From 09bc239e7cbb8b210cd0fc9d7d6571b5c2185454 Mon Sep 17 00:00:00 2001 From: okJiang Date: Thu, 23 May 2024 16:32:19 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: JmPotato Signed-off-by: okJiang <819421878@qq.com> --- client/http/interface.go | 1 + tools/pd-ctl/pdctl/command/health_command.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/http/interface.go b/client/http/interface.go index 76fe133f1ac..ca14b3ae40f 100644 --- a/client/http/interface.go +++ b/client/http/interface.go @@ -338,6 +338,7 @@ func (c *client) SetStoreLabels(ctx context.Context, storeID int64, storeLabels WithBody(jsonInput)) } +// GetHealthStatus gets the health status of the cluster. func (c *client) GetHealthStatus(ctx context.Context) ([]Health, error) { var healths []Health err := c.request(ctx, newRequestInfo(). diff --git a/tools/pd-ctl/pdctl/command/health_command.go b/tools/pd-ctl/pdctl/command/health_command.go index 96a0e9069c2..9ffe5bb539a 100644 --- a/tools/pd-ctl/pdctl/command/health_command.go +++ b/tools/pd-ctl/pdctl/command/health_command.go @@ -32,7 +32,7 @@ func NewHealthCommand() *cobra.Command { } func showHealthCommandFunc(cmd *cobra.Command, _ []string) { - health, err := PDCli.GetHealthStatus(context.Background()) + health, err := PDCli.GetHealthStatus(cmd.Context()) if err != nil { cmd.Println(err) return