Skip to content

Commit

Permalink
fix(pkg/client): allow the outputs watch to say goodbye
Browse files Browse the repository at this point in the history
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Co-Authored-By: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
  • Loading branch information
3 people authored and poiana committed Jun 30, 2020
1 parent 21da9cd commit 4f09e3e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,9 @@ func (c *Client) OutputsWatch(ctx context.Context,
go func() {
for {
res, err := fcs.Recv()
if err == io.EOF {
break
}
if err != nil {
errCh <- fmt.Errorf("error closing stream after EOF: %v", err)
errCh <- err
return
}
resCh <- res
}
Expand All @@ -149,6 +147,9 @@ func (c *Client) OutputsWatch(ctx context.Context,
return err
}
case err := <-errCh:
if err == io.EOF {
return nil
}
return err
case <-time.After(timeout):
fcs.Send(&outputs.Request{})
Expand Down

0 comments on commit 4f09e3e

Please sign in to comment.