Explorar o código

Merge pull request #41360 from lzhfromustc/GL_5

Builder: Add 1 buffer to two channels to avoid blocking goroutine
Brian Goff %!s(int64=4) %!d(string=hai) anos
pai
achega
bf6f0d82bc

+ 1 - 1
builder/dockerfile/containerbackend.go

@@ -45,7 +45,7 @@ var errCancelled = errors.New("build cancelled")
 // Run a container by ID
 // Run a container by ID
 func (c *containerManager) Run(ctx context.Context, cID string, stdout, stderr io.Writer) (err error) {
 func (c *containerManager) Run(ctx context.Context, cID string, stdout, stderr io.Writer) (err error) {
 	attached := make(chan struct{})
 	attached := make(chan struct{})
-	errCh := make(chan error)
+	errCh := make(chan error, 1)
 	go func() {
 	go func() {
 		errCh <- c.backend.ContainerAttachRaw(cID, nil, stdout, stderr, true, attached)
 		errCh <- c.backend.ContainerAttachRaw(cID, nil, stdout, stderr, true, attached)
 	}()
 	}()

+ 1 - 1
integration/plugin/logging/read_test.go

@@ -73,7 +73,7 @@ func TestReadPluginNoRead(t *testing.T) {
 
 
 			buf := bytes.NewBuffer(nil)
 			buf := bytes.NewBuffer(nil)
 
 
-			errCh := make(chan error)
+			errCh := make(chan error, 1)
 			go func() {
 			go func() {
 				_, err := stdcopy.StdCopy(buf, buf, logs)
 				_, err := stdcopy.StdCopy(buf, buf, logs)
 				errCh <- err
 				errCh <- err