WangzJi commented on code in PR #3023:
URL: https://github.com/apache/dubbo-go/pull/3023#discussion_r2347776179
##########
filter/accesslog/filter.go:
##########
@@ -182,6 +189,63 @@ func (f *Filter) OnResponse(_ context.Context, result
result.Result, _ base.Invo
return result
}
+// processLogs runs in a background goroutine to process log data
+func (f *Filter) processLogs() {
+ defer func() {
+ if r := recover(); r != nil {
+ logger.Errorf("AccessLog processLogs panic: %v", r)
+ }
+ f.drainLogs()
+ }()
+
+ for {
+ select {
+ case accessLogData, ok := <-f.logChan:
+ if !ok {
+ return
+ }
+ f.writeLogToFileWithTimeout(accessLogData,
5*time.Second)
Review Comment:
Hi, @LQyt2012. Thank you for the valuable feedback!
I agree that making the timeout configurable would be useful in edge cases
with higher I/O latency.
However, I suggest handling this as a separate enhancement PR, so that this
PR stays focused:
- The current 5s timeout is sufficient for most production scenarios (writes
usually complete within milliseconds).
- Making it configurable would require broader changes (filter struct,
config parsing, URL params, etc.).
--
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]