Merge pull request #5806 from icecrime/5766-events_endless_newlines
Issue #5766 - Check channel closed state in /events loop
This commit is contained in:
commit
49deffe6fe
2 changed files with 5 additions and 1 deletions
1
AUTHORS
1
AUTHORS
|
@ -28,6 +28,7 @@ Anthony Bishopric <git@anthonybishopric.com>
|
|||
Anton Nikitin <anton.k.nikitin@gmail.com>
|
||||
Antony Messerli <amesserl@rackspace.com>
|
||||
apocas <petermdias@gmail.com>
|
||||
Arnaud Porterie <arnaud.porterie@gmail.com>
|
||||
Asbjørn Enge <asbjorn@hanafjedle.net>
|
||||
Barry Allard <barry.allard@gmail.com>
|
||||
Bartłomiej Piotrowski <b@bpiotrowski.pl>
|
||||
|
|
|
@ -259,7 +259,10 @@ func (srv *Server) Events(job *engine.Job) engine.Status {
|
|||
}
|
||||
for {
|
||||
select {
|
||||
case event := <-listener:
|
||||
case event, ok := <-listener:
|
||||
if !ok { // Channel is closed: listener was evicted
|
||||
return engine.StatusOK
|
||||
}
|
||||
err := sendEvent(&event)
|
||||
if err != nil && err.Error() == "JSON error" {
|
||||
continue
|
||||
|
|
Loading…
Add table
Reference in a new issue