empiredan commented on code in PR #2162:
URL:
https://github.com/apache/incubator-pegasus/pull/2162#discussion_r1899899250
##########
admin-cli/executor/client.go:
##########
@@ -65,5 +70,24 @@ func NewClient(writer io.Writer, metaAddrs []string) *Client
{
Meta: meta,
Nodes: util.NewPegasusNodeManager(metaAddrs, replicaAddrs),
Perf: aggregate.NewPerfClient(metaAddrs),
+ }, nil
+}
+
+func CloseClient(client *Client) error {
+ var errorStrings []string
+ err := client.Meta.Close()
+ if err != nil {
+ fmt.Printf("Error: failed to close meta session [%s]\n", err)
+ errorStrings = append(errorStrings, err.Error())
Review Comment:
What are the possible errors occurring here ? I think they could just be
ignored so we would continue to close other components as belows ?
##########
admin-cli/executor/client.go:
##########
@@ -65,5 +70,24 @@ func NewClient(writer io.Writer, metaAddrs []string) *Client
{
Meta: meta,
Nodes: util.NewPegasusNodeManager(metaAddrs, replicaAddrs),
Perf: aggregate.NewPerfClient(metaAddrs),
+ }, nil
+}
+
+func CloseClient(client *Client) error {
+ var errorStrings []string
+ err := client.Meta.Close()
+ if err != nil {
+ fmt.Printf("Error: failed to close meta session [%s]\n", err)
+ errorStrings = append(errorStrings, err.Error())
+ }
+
+ client.Perf.Close()
+
+ err = client.Nodes.CloseAllNodes()
+ if err != nil {
+ fmt.Printf("Error: failed to close nodes session [%s]\n", err)
+ errorStrings = append(errorStrings, err.Error())
}
+
+ return fmt.Errorf("%s", strings.Join(errorStrings, "\n"))
Review Comment:
Just return `nil` if there is not any error.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]