Skip to content

Commit

Permalink
fix: ignore ErrCloseSent during log tail
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ctrox committed Jul 24, 2024
1 parent 5e997cd commit 2eec095
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/log/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package log

import (
"context"
"errors"
"fmt"
"os"
"sort"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 2eec095

Please sign in to comment.