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:
Hugo Dutka
2026-06-18 08:28:17 +00:00
committed by GitHub
parent 91543c391d
commit 803daaa8b7
+3
View File
@@ -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
}