From 479757bf81ee6fe087bd6d1cd3ab77390c9fa477 Mon Sep 17 00:00:00 2001 From: HF Date: Wed, 27 Dec 2023 19:23:20 +0800 Subject: [PATCH] feat: bookmark and error response should be skipped in yurthub filter (#1868) (#1873) Signed-off-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 9a4e5133958..8a5dabbe8be 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{