Explorar el Código

Merge pull request #19420 from clnperez/close-notify-fix

Move closeNotify to fix panic with newer golang
Brian Goff hace 9 años
padre
commit
b6be645197
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      api/server/router/build/build_routes.go

+ 2 - 1
api/server/router/build/build_routes.go

@@ -227,10 +227,11 @@ func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
 	if closeNotifier, ok := w.(http.CloseNotifier); ok {
 		finished := make(chan struct{})
 		defer close(finished)
+		clientGone := closeNotifier.CloseNotify()
 		go func() {
 			select {
 			case <-finished:
-			case <-closeNotifier.CloseNotify():
+			case <-clientGone:
 				logrus.Infof("Client disconnected, cancelling job: build")
 				b.Cancel()
 			}