From 2eec0953c44980699546ce96d3fcba059560e30b Mon Sep 17 00:00:00 2001 From: Cyrill Troxler Date: Wed, 24 Jul 2024 10:08:37 +0200 Subject: [PATCH] fix: ignore ErrCloseSent during log tail Most of the time when the client closes the connection (nctl is terminated by ctrl+c) we get an ErrCloseSent so we should ignore it and not output an error to the user. --- api/log/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/log/client.go b/api/log/client.go index 73fc5db..58f991f 100644 --- a/api/log/client.go +++ b/api/log/client.go @@ -2,6 +2,7 @@ package log import ( "context" + "errors" "fmt" "os" "sort" @@ -200,7 +201,7 @@ func (c *Client) TailQuery(ctx context.Context, delayFor time.Duration, out outp continue } - if websocket.IsCloseError(err, websocket.CloseNormalClosure) { + if websocket.IsCloseError(err, websocket.CloseNormalClosure) || errors.Is(websocket.ErrCloseSent, err) { return nil }