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