lizining1231 commented on code in PR #3713:
URL: https://github.com/apache/dubbo-go/pull/3713#discussion_r3896365927


##########
filter/accesslog/filter.go:
##########
@@ -90,19 +90,28 @@ type Filter struct {
        ctx          context.Context
        cancel       context.CancelFunc
        shutdownOnce sync.Once
+       started      chan struct{} // closed once processLogs is running
+       done         chan struct{} // closed once processLogs has exited

Review Comment:
   可以,换了个方案,可读性略降低,不过不改主代码只改测试
   测试改用 runtime.Stack 栈帧 + goroutine ID 绑定
   - 启动断言:走真实 newFilter(),轮询 runtime.Stack 快照直至 processLogs goroutine 出现。同时捕获其 
goroutine ID,是出于当newFilter 忘记启动 goroutine时,processLogs 不出现,测试正常挂
   - 退出断言:Shutdown() 后等那个具体 ID 消失,不再依赖原先测试使用 process-wide goroutine 计数



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