Skip to content

Commit 647bf39

Browse files
tarasmadanramosian-glider
authored andcommitted
dashboard/dashapi: change json encoding to stream
It may help to compress huge coverage json w/o OOM.
1 parent 3547e30 commit 647bf39

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

dashboard/dashapi/dashapi.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,13 +1033,10 @@ func (dash *Dashboard) queryImpl(method string, req, reply interface{}) error {
10331033
if err != nil {
10341034
return err
10351035
}
1036-
data, err := json.Marshal(req)
1037-
if err != nil {
1038-
return fmt.Errorf("failed to marshal request: %w", err)
1039-
}
10401036
gz := gzip.NewWriter(w)
1041-
if _, err := gz.Write(data); err != nil {
1042-
return err
1037+
encoder := json.NewEncoder(gz)
1038+
if err := encoder.Encode(req); err != nil {
1039+
return fmt.Errorf("failed to marshal request: %w", err)
10431040
}
10441041
if err := gz.Close(); err != nil {
10451042
return err

0 commit comments

Comments
 (0)