Alanxtl commented on code in PR #876:
URL: https://github.com/apache/dubbo-go-pixiu/pull/876#discussion_r2766875123


##########
pkg/filter/sentinel/circuitbreaker/circuit_breaker.go:
##########
@@ -101,7 +104,40 @@ func (f *Filter) Decode(ctx *http.HttpContext) 
filter.FilterStatus {
                ctx.SendLocalReply(errResp.Status, errResp.ToJSON())
                return filter.Stop
        }
+
+       // Store entry in context for later use in Encode phase
+       if ctx.Params == nil {
+               ctx.Params = make(map[string]any)
+       }
+       ctx.Params[ContextKeySentinelEntry] = entry
+
+       return filter.Continue
+}
+
+// Encode processes the response and reports statistics to Sentinel
+func (f *Filter) Encode(ctx *http.HttpContext) filter.FilterStatus {
+       entryVal, ok := ctx.Params[ContextKeySentinelEntry]

Review Comment:
   这里是不是也要先检查一下
   ```go
   if ctx.Params == nil {
                ctx.Params = make(map[string]any)
        }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to