Skip to content

Commit

Permalink
Place buffer infront of the decoder and not the connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfonso Acosta committed Feb 19, 2016
1 parent e9383a8 commit 3acc202
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions probe/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ func (c *container) StartGatheringStats() error {
return
}

bufReader := bufio.NewReaderSize(dial, 8192)
conn := NewClientConnStub(dial, bufReader)
conn := NewClientConnStub(dial, nil)
resp, err := conn.Do(req)
if err != nil {
log.Errorf("docker container: %v", err)
Expand All @@ -204,7 +203,8 @@ func (c *container) StartGatheringStats() error {
}()

var stats docker.Stats
decoder := codec.NewDecoder(resp.Body, &codec.JsonHandle{})
bufReader := bufio.NewReader(resp.Body)
decoder := codec.NewDecoder(bufReader, &codec.JsonHandle{})
for err := decoder.Decode(&stats); err != io.EOF; err = decoder.Decode(&stats) {
if err != nil {
log.Errorf("docker container: error reading event, did container stop? %v", err)
Expand Down

0 comments on commit 3acc202

Please sign in to comment.