mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
fix(coderd/x/chatd): deflake TestStreamPartsDialerDialsPartsEndpoint (#26504)
Closes https://github.com/coder/internal/issues/1601. Fixes a stream parts WebSocket close race. If the peer closed first, the session read loop could close the connection before `StreamPartsSession.Close()` ran, causing cleanup to return a wrapped `net.ErrClosed`. The fix treats expected transport close errors as successful cleanup.
This commit is contained in:
@@ -214,6 +214,9 @@ func (s *streamPartsTransportSession) Close() error {
|
||||
s.closeOnce.Do(func() {
|
||||
s.cancel()
|
||||
s.closeErr = s.transport.Close()
|
||||
if streamPartsExpectedTransportClose(s.closeErr) {
|
||||
s.closeErr = nil
|
||||
}
|
||||
})
|
||||
return s.closeErr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user