@@ -30,41 +30,35 @@ var (
3030 }
3131)
3232
33- func (u * CancelOnFilter ) OnBucketPour (bucketFactory * BucketFactory ) func (pipeline.Event , * Leaky ) * pipeline.Event {
34- return func (msg pipeline.Event , leaky * Leaky ) * pipeline.Event {
35- var condition , ok bool
36- if u .CancelOnFilter != nil {
37- leaky .logger .Tracef ("running cancel_on filter" )
38- output , err := exprhelpers .Run (u .CancelOnFilter , map [string ]any {"evt" : & msg }, leaky .logger , u .Debug )
39- if err != nil {
40- leaky .logger .Warningf ("cancel_on error : %s" , err )
41- return & msg
42- }
43- if condition , ok = output .(bool ); ! ok {
44- leaky .logger .Warningf ("cancel_on, unexpected non-bool return : %T" , output )
45- return & msg
46- }
47- if condition {
48- leaky .logger .Debugf ("reset_filter matched, kill bucket" )
49- leaky .Suicide <- true
50- return nil //counter intuitively, we need to keep the message so that it doesn't trigger an endless loop
51- }
52- leaky .logger .Debugf ("reset_filter didn't match" )
33+ func (u * CancelOnFilter ) OnBucketPour (_ * BucketFactory , msg pipeline.Event , leaky * Leaky ) * pipeline.Event {
34+ var condition , ok bool
35+ if u .CancelOnFilter != nil {
36+ leaky .logger .Tracef ("running cancel_on filter" )
37+ output , err := exprhelpers .Run (u .CancelOnFilter , map [string ]any {"evt" : & msg }, leaky .logger , u .Debug )
38+ if err != nil {
39+ leaky .logger .Warningf ("cancel_on error : %s" , err )
40+ return & msg
5341 }
54- return & msg
42+ if condition , ok = output .(bool ); ! ok {
43+ leaky .logger .Warningf ("cancel_on, unexpected non-bool return : %T" , output )
44+ return & msg
45+ }
46+ if condition {
47+ leaky .logger .Debugf ("reset_filter matched, kill bucket" )
48+ leaky .Suicide <- true
49+ return nil // counter intuitively, we need to keep the message so that it doesn't trigger an endless loop
50+ }
51+ leaky .logger .Debugf ("reset_filter didn't match" )
5552 }
53+ return & msg
5654}
5755
58- func (* CancelOnFilter ) OnBucketOverflow (bucketFactory * BucketFactory ) func (* Leaky , pipeline.RuntimeAlert , * pipeline.Queue ) (pipeline.RuntimeAlert , * pipeline.Queue ) {
59- return func (leaky * Leaky , alert pipeline.RuntimeAlert , queue * pipeline.Queue ) (pipeline.RuntimeAlert , * pipeline.Queue ) {
60- return alert , queue
61- }
56+ func (* CancelOnFilter ) OnBucketOverflow (_ * BucketFactory , _ * Leaky , alert pipeline.RuntimeAlert , queue * pipeline.Queue ) (pipeline.RuntimeAlert , * pipeline.Queue ) {
57+ return alert , queue
6258}
6359
64- func (* CancelOnFilter ) AfterBucketPour (bucketFactory * BucketFactory ) func (pipeline.Event , * Leaky ) * pipeline.Event {
65- return func (msg pipeline.Event , leaky * Leaky ) * pipeline.Event {
66- return & msg
67- }
60+ func (* CancelOnFilter ) AfterBucketPour (_ * BucketFactory , msg pipeline.Event , _ * Leaky ) * pipeline.Event {
61+ return & msg
6862}
6963
7064func (u * CancelOnFilter ) OnBucketInit (bucketFactory * BucketFactory ) error {
@@ -87,7 +81,7 @@ func (u *CancelOnFilter) OnBucketInit(bucketFactory *BucketFactory) error {
8781 }
8882
8983 cancelExprCacheLock .Unlock ()
90- //release the lock during compile
84+ // release the lock during compile
9185
9286 compiledExpr .CancelOnFilter , err = expr .Compile (bucketFactory .CancelOnFilter , exprhelpers .GetExprOptions (map [string ]any {"evt" : & pipeline.Event {}})... )
9387 if err != nil {
0 commit comments