Permalink
Browse files

Merge pull request #231 from chaosbox/timeout_toxic_creates_unnecessa…

…ry_timers

Bail out of the loop when the stub Input stream is done
  • Loading branch information...
jpittis committed Dec 18, 2018
2 parents c2c119c + 1390d99 commit 7eb6f30c2c5a2b750732be86b7717b1d6970c879
Showing with 10 additions and 2 deletions.
  1. +10 −2 toxics/timeout.go
@@ -19,7 +19,11 @@ func (t *TimeoutToxic) Pipe(stub *ToxicStub) {
return
case <-stub.Interrupt:
return
case <-stub.Input:
case c := <-stub.Input:
if c == nil {
stub.Close()
return
}
// Drop the data on the ground.
}
}
@@ -28,7 +32,11 @@ func (t *TimeoutToxic) Pipe(stub *ToxicStub) {
select {
case <-stub.Interrupt:
return
case <-stub.Input:
case c := <-stub.Input:
if c == nil {
stub.Close()
return
}
// Drop the data on the ground.
}
}

0 comments on commit 7eb6f30

Please sign in to comment.