Move closeNotify to fix panic with newer golang
This is happening now due to improvements in net/http:
99fb19194c
To test, change the go version in the Dockerfile:
-ENV GO_VERSION 1.5.3
+ENV GO_VERSION 1.6beta2
More info here: https://github.com/golang/go/issues/14001
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
This commit is contained in:
parent
2cd74f9932
commit
2df5dafdaf
1 changed files with 2 additions and 1 deletions
|
@ -241,10 +241,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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue