AlexStocks commented on code in PR #1133:
URL: https://github.com/apache/dubbo-go-samples/pull/1133#discussion_r3780939663


##########
graceful_shutdown/go-server/cmd/main.go:
##########
@@ -38,22 +41,36 @@ import (
 )
 
 type GreetProvider struct {
-       fixedDelay time.Duration
+       fixedDelay           time.Duration
+       ignoreContextCancel  bool
+       shutdownOnFirstGreet bool
+       shutdownOnce         sync.Once
+       shuttingDown         atomic.Bool
 }
 
 func (p *GreetProvider) Greet(ctx context.Context, req *greet.GreetRequest) 
(*greet.GreetResponse, error) {
+       if p.shuttingDown.Load() {

Review Comment:
   [P1] 这个本地标志会让集成测试绕过真正的优雅停机拒绝路径。`triggerShutdownOnFirstGreet` 在发送 SIGINT 前先把 
`shuttingDown` 设为 `true`,第二个短连接请求即使穿过 Dubbo 的 provider graceful-shutdown 
filter,也会在这里由样例代码直接返回错误;客户端只统计 1 次成功和 1 次失败,所以框架的 `RejectRequest` 
阶段失效时测试仍可通过。当前 CI 只显示该 sample 退出成功,client/server 
日志被重定向,无法区分错误来源。请去掉应用层拒绝,改为在框架进入拒绝阶段后由独立客户端发起请求,并断言请求没有进入 `Greet` 
handler,同时保留在途请求完成的断言。



-- 
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