feat(bsr): invoke writeAndClose() in encode

This commit is contained in:
Damian Debkowski authored and Elim Tsiagbey committed 2024-01-11 09:58:32 -05:00
1 parent 2157a29e6e
commit 208611ec3e
3 files changed
+7 -18

No files matched your search

+4 -10
View File
@@ -129,15 +129,9 @@ func (e ChunkEncoder) Encode(ctx context.Context, c Chunk) (int, error) {
copy(encodedChunk[chunkBaseSize:], encode.compress.Bytes())
binary.BigEndian.PutUint32(encodedChunk[chunkBaseSize+length:], sum)
if c.GetType() == ChunkEnd {
return e.w.WriteAndClose(encodedChunk)
}
return e.w.Write(encodedChunk)
}
// Close closes the encoder.
func (e *ChunkEncoder) Close() error {
var i interface{} = e.w
v, ok := i.(io.WriteCloser)
if ok {
return v.Close()
}
return nil
}