AlexStocks commented on code in PR #3235:
URL: https://github.com/apache/dubbo-go/pull/3235#discussion_r2902466633
##########
filter/graceful_shutdown/provider_filter.go:
##########
@@ -85,6 +84,12 @@ func (f *providerGracefulShutdownFilter) Invoke(ctx
context.Context, invoker bas
// OnResponse reduces the number of active processes then return the process
result
func (f *providerGracefulShutdownFilter) OnResponse(ctx context.Context,
result result.Result, invoker base.Invoker, invocation base.Invocation)
result.Result {
f.shutdownConfig.ProviderActiveCount.Dec()
+
+ // add closing flag to response
+ if f.isClosing() {
+ result.AddAttachment(constant.GracefulShutdownClosingKey,
"true")
Review Comment:
`result` 可能为 nil(invoker 返回 nil result 时),直接调用 `result.AddAttachment` 会
panic。
建议:加 nil 检查:
```go
if f.isClosing() && result != nil {
result.AddAttachment(constant.GracefulShutdownClosingKey, "true")
}
```
--
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]