rpc: fix a flaky test of the websocket #33002 (#1877)

This commit is contained in:
wit liu 2025-12-19 12:19:47 +08:00 committed by GitHub
parent d976cc65d2
commit d3b35cba42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -971,7 +971,7 @@ func (l *flakeyListener) Accept() (net.Conn, error) {
c, err := l.Listener.Accept()
if err == nil {
timeout := time.Duration(rand.Int63n(int64(l.maxKillTimeout)))
timeout := max(time.Millisecond*10, time.Duration(rand.Int63n(int64(l.maxKillTimeout))))
time.AfterFunc(timeout, func() {
log.Debug(fmt.Sprintf("killing conn %v after %v", c.LocalAddr(), timeout))
c.Close()