From 495fff0a9355a590b597d542fbde1520edd08136 Mon Sep 17 00:00:00 2001 From: dongmen <414110582@qq.com> Date: Wed, 15 Nov 2023 15:46:35 +0800 Subject: [PATCH] fix error --- cdc/api/v2/changefeed.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cdc/api/v2/changefeed.go b/cdc/api/v2/changefeed.go index f8b3107562e..b63a6fabfb7 100644 --- a/cdc/api/v2/changefeed.go +++ b/cdc/api/v2/changefeed.go @@ -600,18 +600,20 @@ func (h *OpenAPIV2) resumeChangefeed(c *gin.Context) { _ = c.Error(err) return } + // use the default pdClient pdClient = up.PDClient } else { credential := cfg.PDConfig.toCredential() timeoutCtx, cancel := context.WithTimeout(ctx, 30*time.Second) defer cancel() + // create a new pdClient pdClient, err = h.helpers.getPDClient(timeoutCtx, cfg.PDAddrs, credential) if err != nil { _ = c.Error(cerror.WrapError(cerror.ErrAPIInvalidParam, err)) return } + defer pdClient.Close() } - defer pdClient.Close() if err := h.helpers.verifyResumeChangefeedConfig( ctx,