Skip to content

Commit

Permalink
flushing load image response before returning success
Browse files Browse the repository at this point in the history
  • Loading branch information
yhlee-aws committed Dec 26, 2018
1 parent 0dd3811 commit d53aaff
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions agent/dockerclient/dockerapi/docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math/rand"
"strconv"
"strings"
Expand Down Expand Up @@ -946,8 +947,8 @@ func (dg *dockerGoClient) handleContainerEvents(ctx context.Context,
metadata := dg.containerMetadata(ctx, containerID)

changedContainers <- DockerContainerChangeEvent{
Status: status,
Type: eventType,
Status: status,
Type: eventType,
DockerContainerMetadata: metadata,
}
}
Expand Down Expand Up @@ -1383,6 +1384,14 @@ func (dg *dockerGoClient) loadImage(ctx context.Context, reader io.Reader) error
if err != nil {
return err
}
_, err = client.ImageLoad(ctx, reader, false)
resp, err := client.ImageLoad(ctx, reader, false)
if err != nil {
return err
}

// flushing response reader
if resp.Body != nil {
_, err = io.Copy(ioutil.Discard, resp.Body)
}
return err
}

0 comments on commit d53aaff

Please sign in to comment.