Skip to content

Commit

Permalink
Found a blocking issue on pubsub transport if a subscriber had an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Nichols committed Sep 11, 2019
1 parent 5088975 commit 08da032
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/cloudevents/transport/pubsub/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,22 +280,25 @@ func (t *Transport) StartReceiver(ctx context.Context) error {
})
}

// Block for parent context to finish.
<-ctx.Done()
cancel()

// Collect errors and done calls until we have n of them.
errs := []string(nil)
for success := 0; success < n; success++ {
var err error
select {
case err = <-errc:
case <-ctx.Done(): // Block for parent context to finish.
case err = <-errc: // Collect errors
case <-quit:
}
if cancel != nil {
// Stop all other subscriptions.
cancel()
cancel = nil
}
if err != nil {
errs = append(errs, err.Error())
}
}

close(quit)
close(errc)

Expand Down

0 comments on commit 08da032

Please sign in to comment.