Skip to content

Commit

Permalink
Merge pull request #2437 from kinvolk/alban/gzip-compression-level-de…
Browse files Browse the repository at this point in the history
…fault

gzip: change compression level to the default
  • Loading branch information
bboreham authored Apr 18, 2017
2 parents b58832d + a8af81f commit c944225
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func RegisterReportPostHandler(a Adder, router *mux.Router) {
// a.Add(..., buf) assumes buf is gzip'd msgpack
if !isMsgpack {
buf = bytes.Buffer{}
rpt.WriteBinary(&buf, gzip.BestCompression)
rpt.WriteBinary(&buf, gzip.DefaultCompression)
}

if err := a.Add(ctx, rpt, buf.Bytes()); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion probe/appclient/report_publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ func (p *ReportPublisher) Publish(r report.Report) error {
})
}
buf := &bytes.Buffer{}
r.WriteBinary(buf, gzip.BestCompression)
r.WriteBinary(buf, gzip.DefaultCompression)
return p.publisher.Publish(buf)
}
4 changes: 2 additions & 2 deletions report/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestRoundtrip(t *testing.T) {
var buf bytes.Buffer
r1 := report.MakeReport()
r1.WriteBinary(&buf, gzip.BestCompression)
r1.WriteBinary(&buf, gzip.DefaultCompression)
bytes := append([]byte{}, buf.Bytes()...) // copy the contents for later
r2, err := report.MakeFromBinary(&buf)
if err != nil {
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestMoreCompressionMeansSmaller(t *testing.T) {
// Make sure that 0 level compression actually does compress less.
var buf1, buf2 bytes.Buffer
r := report.MakeReport()
r.WriteBinary(&buf1, gzip.BestCompression)
r.WriteBinary(&buf1, gzip.DefaultCompression)
r.WriteBinary(&buf2, 0)
if buf1.Len() >= buf2.Len() {
t.Errorf("Compression doesn't change size: %v >= %v", buf1.Len(), buf2.Len())
Expand Down

0 comments on commit c944225

Please sign in to comment.