Copilot commented on code in PR #671:
URL: 
https://github.com/apache/skywalking-banyandb/pull/671#discussion_r2094745049


##########
banyand/liaison/http/server.go:
##########
@@ -283,7 +283,7 @@ func (p *server) Serve() run.StopNotify {
 // initGRPCClient initializes or reinitializes the gRPC client with current 
credentials.
 func (p *server) initGRPCClient() error {
        // Clean up any existing client first
-       if p.grpcClient != nil {
+       if client := p.grpcClient.Load(); client != nil {
                p.l.Debug().Msg("Cleaning up existing gRPC client")

Review Comment:
   Consider closing or cleaning up the previous `healthcheck.Client` instance 
(e.g., calling `client.Close()`) before overwriting it to avoid potential 
resource leaks.
   ```suggestion
                if oldClient, ok := client.(*healthcheck.Client); ok {
                        p.l.Debug().Msg("Closing existing gRPC client")
                        oldClient.Close()
                } else {
                        p.l.Warn().Msg("Existing gRPC client is not of type 
*healthcheck.Client")
                }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to