Skip to content

Commit

Permalink
[Vinod|Dhanesh] Breaks out of subscription loop when err is returned …
Browse files Browse the repository at this point in the history
…on subscription stream
  • Loading branch information
dhanesh committed Jan 3, 2019
1 parent 91c19cc commit b003909
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions stream/subscription_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func (es *subscriptionStream) Stream() error {
return
}
if err != nil {
// log.Printf("failed to receive message on stream: %v", err)
log.Printf("failed to receive message on stream: %v", err)
return
} else if in.VersionInfo == "" {
log.Printf("received discovery request on stream: %v", in)
es.hub.Publish(&pubsub.Event{CLA: es.service.CLA(), Clusters: es.service.Clusters(), Routes: es.service.Routes()})
Expand All @@ -45,7 +46,11 @@ func (es *subscriptionStream) Stream() error {
responseStream := NewDiscoveryResponseStream(es.stream)
for {
select {
case e := <-es.subscription.Events:
case e, open := <-es.subscription.Events:
if !open {
log.Printf("Stopped listening to events channel since it has been closed")
return
}
if e != nil {
responseStream.SendCDS(e.Clusters)
responseStream.SendRDS(e.Routes)
Expand Down

0 comments on commit b003909

Please sign in to comment.