mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #19420 from clnperez/close-notify-fix
Move closeNotify to fix panic with newer golang
This commit is contained in:
commit
b6be645197
1 changed files with 2 additions and 1 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue