From cb2055bc5ba04b202900eaeeda3437eea1192626 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 19:33:15 +0800 Subject: [PATCH] feat: bookmark and error response should be skipped in yurthub filter (#1868) (#1953) Signed-off-by: HF (cherry picked from commit 286a43ef3827f80f7480ef9ece245ff3577b898a) Co-authored-by: HF --- pkg/yurthub/filter/filter.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/yurthub/filter/filter.go b/pkg/yurthub/filter/filter.go index 9700fb4a3d6..1b345788ca7 100644 --- a/pkg/yurthub/filter/filter.go +++ b/pkg/yurthub/filter/filter.go @@ -238,9 +238,12 @@ func (frc *filterReadCloser) StreamResponseFilter(rc io.ReadCloser, ch chan *byt return err } - newObj := frc.objectFilter.Filter(obj, frc.stopCh) - if yurtutil.IsNil(newObj) { - continue + newObj := obj + // BOOKMARK and ERROR response are unnecessary to filter + if !(watchType == watch.Bookmark || watchType == watch.Error) { + if newObj = frc.objectFilter.Filter(obj, frc.stopCh); yurtutil.IsNil(newObj) { + continue + } } wEvent := watch.Event{