DaWesen commented on code in PR #3695:
URL: https://github.com/apache/dubbo-go/pull/3695#discussion_r3841325469
##########
filter/graceful_shutdown/consumer_filter.go:
##########
@@ -98,7 +98,7 @@ func (f *consumerGracefulShutdownFilter) Invoke(ctx
context.Context, invoker bas
// OnResponse reduces the number of active processes then return the process
result
func (f *consumerGracefulShutdownFilter) OnResponse(ctx context.Context,
result result.Result, invoker base.Invoker, invocation base.Invocation)
result.Result {
if f.shutdownConfig != nil && shouldDecrementConsumerActive(result) {
- f.shutdownConfig.ConsumerActiveCount.Dec()
+ f.shutdownConfig.ConsumerActiveCount.Add(-1)
Review Comment:
go.uber.org/atomic 提供了 Dec() 便捷方法(实现就是 i.Add(-1)),但标准库的 sync/atomic.Int32 只有
Add/Load/Store/Swap/CompareAndSwap 等方法,没有 Dec()。所以这里只是把 Dec() 机械改写成语义完全等价的
Add(-1)。 说明:行为无任何变化。
##########
filter/graceful_shutdown/provider_filter.go:
##########
@@ -93,7 +93,7 @@ func (f *providerGracefulShutdownFilter) OnResponse(ctx
context.Context, res res
}
if shouldDecrementProviderActive(res) {
- f.shutdownConfig.ProviderActiveCount.Dec()
+ f.shutdownConfig.ProviderActiveCount.Add(-1)
Review Comment:
同上
--
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]