r27153733 commented on PR #2621:
URL: https://github.com/apache/dubbo-go/pull/2621#issuecomment-2002755940
> Thanks! A few comments about code style.
>
> In addition, I have another concern: `sentinel.TraceError` is called by
`OnResponse()` previously, but now is called by `Invoke()`. **THE SIDE EFFECT:
You changes the behavior of the filter.**
>
> IMHO, your concern is that the context isn't updated with the latest data,
right? So a possible fix could be:
>
> ```go
> func (fi *FilterInvoker) Invoke(ctx context.Context, invocation
protocol.Invocation) protocol.Result {
> result := fi.filter.Invoke(ctx, fi.next, invocation)
> // do something to copy the context from the latest one
> return fi.filter.OnResponse(ctx, result, fi.invoker, invocation)
> }
> ```
>
> Wdyt?
>
> UPDATE 1: Maybe the above way is not easy to implement. But the main idea
is to share the context between `fi.filter.Invoke()` and
`fi.filter.OnResponse()`.
我也想在fi.filter.Invoke() 和
fi.filter.OnResponse()中共享上下文,很遗憾的是修改FilterInvoker是不够的,必须修改Filter接口的定义。
我曾经想从java中找到灵感,但是...
--
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]