From 9267ee3561ccbb90589600d7b045f7e05b1b2ee0 Mon Sep 17 00:00:00 2001 From: Emad Mohamadi <33651341+emadolsky@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:42:26 +0200 Subject: [PATCH] fix(canary): Reconnect immediately upon tail max duration (#14287) --- pkg/canary/reader/reader.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/canary/reader/reader.go b/pkg/canary/reader/reader.go index 88af34ce8e75..c98a7cab8fd7 100644 --- a/pkg/canary/reader/reader.go +++ b/pkg/canary/reader/reader.go @@ -390,6 +390,14 @@ func (r *Reader) run() { // or times out based on the above SetReadDeadline call. err := unmarshal.ReadTailResponseJSON(tailResponse, r.conn) if err != nil { + var e *websocket.CloseError + if errors.As(err, &e) && e.Text == "reached tail max duration limit" { + fmt.Fprintf(r.w, "tail max duration limit exceeded, will retry immediately: %s\n", err) + + r.closeAndReconnect() + continue + } + reason := "error reading websocket" if e, ok := err.(net.Error); ok && e.Timeout() { reason = fmt.Sprintf("timeout tailing new logs (timeout period: %.2fs)", timeoutInterval.Seconds())