Skip to content

Commit

Permalink
Add a if to not send logs when context is canceled
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Savian <[email protected]>
  • Loading branch information
vitorsavian committed Mar 13, 2024
1 parent 4a50456 commit 4988f55
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/logstructured/logstructured.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package logstructured

import (
"context"
"errors"
"sync"
"time"

Expand Down Expand Up @@ -446,7 +447,9 @@ func (l *LogStructured) Watch(ctx context.Context, prefix string, revision int64

rev, kvs, err := l.log.After(ctx, prefix, revision, 0)
if err != nil {
logrus.Errorf("Failed to list %s for revision %d: %v", prefix, revision, err)
if !errors.Is(err, context.Canceled) {
logrus.Errorf("Failed to list %s for revision %d: %v", prefix, revision, err)
}
if err == server.ErrCompacted {
compact, _ := l.log.CompactRevision(ctx)
wr.CompactRevision = compact
Expand Down

0 comments on commit 4988f55

Please sign in to comment.