Skip to content

Commit

Permalink
always stop the stream
Browse files Browse the repository at this point in the history
  • Loading branch information
peterebden committed Mar 26, 2024
1 parent 189ea03 commit 16f23ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mettle/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ func (s *server) WaitExecution(req *pb.WaitExecutionRequest, stream pb.Execution

// streamEvents streams a series of events back to the client.
func (s *server) streamEvents(digest *pb.Digest, ch <-chan *longrunning.Operation, stream pb.Execution_ExecuteServer) error {
defer s.stopStream(digest, ch)
for op := range ch {
op.Name = digest.Hash
if err := stream.Send(op); err != nil {
log.Warning("Failed to forward event for %s: %s", digest.Hash, err)
s.stopStream(digest, ch)
return err
}
if op.Done {
Expand Down

0 comments on commit 16f23ce

Please sign in to comment.