Skip to content

Commit

Permalink
Events: Remove unused channel from EventHandler context
Browse files Browse the repository at this point in the history
This commit removes a channel that became unneccessary
after the refactoring of the events server and is
preventing garbage collection of the handler struct
when it goes out of scope. It also adds back the
return of an error upon an errant send which will
close the chat processing loop

Change-Id: I2a771ee0e1d1c2518062c9bec962b48dd2d41e56
Signed-off-by: Patrick Mullaney <pm.mullaney@gmail.com>
  • Loading branch information
pmullaney committed Aug 30, 2016
1 parent 9e3bfde commit b61bb9f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions events/producer/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (

type handler struct {
ChatStream pb.Events_ChatServer
doneChan chan bool
interestedEvents map[string]*pb.Interest
}

Expand All @@ -34,15 +33,13 @@ func newEventHandler(stream pb.Events_ChatServer) (*handler, error) {
ChatStream: stream,
}
d.interestedEvents = make(map[string]*pb.Interest)
d.doneChan = make(chan bool)
return d, nil
}

// Stop stops this handler
func (d *handler) Stop() error {
d.deregisterAll()
d.interestedEvents = nil
d.doneChan <- true
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion events/producer/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (p *EventsServer) Chat(stream pb.Events_ChatServer) error {
err = handler.HandleMessage(in)
if err != nil {
producerLogger.Errorf("Error handling message: %s", err)
//return err
return err
}

}
Expand Down

0 comments on commit b61bb9f

Please sign in to comment.