Check if login stream was canceled before printing warn (#451)

This commit is contained in:
Maycon Santos
2022-09-05 17:44:26 +02:00
committed by GitHub
parent 1012172f04
commit b63ec71aed
2 changed files with 17 additions and 14 deletions

View File

@@ -36,7 +36,10 @@ func Login(ctx context.Context, config *Config, setupKey string, jwtToken string
defer func() {
err = mgmClient.Close()
if err != nil {
log.Warnf("failed to close the Management service client %v", err)
cStatus, ok := status.FromError(err)
if !ok || ok && cStatus.Code() != codes.Canceled {
log.Warnf("failed to close the Management service client, err: %v", err)
}
}
}()