Merge pull request #58249 from ilackarms/compression-flushing

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

periodically flush ResponseWriter when using response compression

This PR fixes API Compression when following logs by ensuring the compression writer periodically flushes (at the end of each write).

This is a commit extracted from #51508 to allow testing of flushing while feature remains disabled / in alpha.

Fixes https://github.com/kubernetes/kubernetes/issues/54205

```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2018-01-13 12:08:02 -08:00 committed by GitHub
commit 32dc50476e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -136,6 +136,7 @@ func (c *compressionResponseWriter) Write(p []byte) (int, error) {
return -1, errors.New("compressing error: tried to write data using closed compressor")
}
c.Header().Set(headerContentEncoding, c.encoding)
defer c.compressor.Flush()
return c.compressor.Write(p)
}