justxuewei commented on code in PR #2621: URL: https://github.com/apache/dubbo-go/pull/2621#discussion_r1527405272
########## filter/sentinel/filter.go: ########## @@ -110,6 +101,12 @@ type sentinelProviderFilter struct{} func newSentinelProviderFilter() filter.Filter { if sentinelProvider == nil { + initOnce.Do(func() { + err := sentinel.InitDefault() + if err != nil { + panic(err) + } Review Comment: ```suggestion if err := sentinel.InitDefault(); err != nil { panic(err) } ``` ########## filter/sentinel/filter.go: ########## @@ -177,22 +187,27 @@ func (d *sentinelConsumerFilter) Invoke(ctx context.Context, invoker protocol.In if b != nil { // interface blocked return sentinelDubboConsumerFallback(ctx, invoker, invocation, b) + } else { + defer interfaceEntry.Exit() } Review Comment: Ditto. ########## filter/sentinel/filter.go: ########## @@ -129,8 +126,9 @@ func (d *sentinelProviderFilter) Invoke(ctx context.Context, invoker protocol.In if b != nil { // interface blocked return sentinelDubboProviderFallback(ctx, invoker, invocation, b) + } else { + defer interfaceEntry.Exit() } Review Comment: `else` here could be removed. ```suggestion } defer interfaceEntry.Exit() ``` ########## filter/sentinel/filter.go: ########## @@ -177,22 +187,27 @@ func (d *sentinelConsumerFilter) Invoke(ctx context.Context, invoker protocol.In if b != nil { // interface blocked return sentinelDubboConsumerFallback(ctx, invoker, invocation, b) + } else { + defer interfaceEntry.Exit() } - ctx = context.WithValue(ctx, InterfaceEntryKey, interfaceEntry) methodEntry, b = sentinel.Entry(methodResourceName, sentinel.WithResourceType(base.ResTypeRPC), sentinel.WithTrafficType(base.Outbound), sentinel.WithArgs(invocation.Arguments()...)) if b != nil { // method blocked return sentinelDubboConsumerFallback(ctx, invoker, invocation, b) + } else { + defer methodEntry.Exit() } Review Comment: Ditto. ########## filter/sentinel/filter.go: ########## @@ -139,13 +137,19 @@ func (d *sentinelProviderFilter) Invoke(ctx context.Context, invoker protocol.In if b != nil { // method blocked return sentinelDubboProviderFallback(ctx, invoker, invocation, b) + } else { + defer methodEntry.Exit() } Review Comment: Ditto. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org