Revert "Send notification in their own goroutine."

After discussion with others and thinking about the notification channel
some more, we've decided to leave it up to the caller to quickly handle
notifications.  While it is true that notification should be handled
quickly to not block the chain processing code unnecessarily, launching a
goroutine in chain means the notifications are no longer necessarily in
order.  Also, if the caller is not properly handling the notifications,
the goroutines end up sicking around forever.  By leaving it up to the
caller to quickly handle the notification or launch a goroutine as
necessary for the caller, it provides the flexibility to ensure proper
notification ordering as well as control over other things such as
how to handle backpressure.
This commit is contained in:
Dave Collins 2013-09-21 09:23:26 -05:00
parent 00b183a8b5
commit d1f1fe0752

View file

@ -71,9 +71,7 @@ func (b *BlockChain) sendNotification(typ NotificationType, data interface{}) {
return
}
// Generate and send the notification asynchronously.
go func() {
n := Notification{Type: typ, Data: data}
b.notifications <- &n
}()
// Generate and send the notification.
n := Notification{Type: typ, Data: data}
b.notifications <- &n
}