fix(bitswap/notifications) don't force sender to block on receiver

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit is contained in:
Brian Tiger Chow 2014-11-19 08:31:32 -08:00
parent f6235c5cc6
commit 3fdbd6cd15

View File

@ -34,7 +34,7 @@ func (ps *impl) Publish(block blocks.Block) {
func (ps *impl) Subscribe(ctx context.Context, k u.Key) <-chan blocks.Block {
topic := string(k)
subChan := ps.wrapped.SubOnce(topic)
blockChannel := make(chan blocks.Block)
blockChannel := make(chan blocks.Block, 1) // buffered so the sender doesn't wait on receiver
go func() {
defer close(blockChannel)
select {