fix(bitswap/notifications) don't force sender to block on receiver
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Nov 19, 2014 at 08:31 UTC
3fdbd6cd15e1e2911ff51fc32405812852cc5560
1 file changed
+1
-1
exchange/bitswap/notifications/notifications.go
+1
-1
@@ -34,7 +34,7 @@ func (ps *impl) Publish(block blocks.Block) {
34
func (ps *impl) Subscribe(ctx context.Context, k u.Key) <-chan blocks.Block {
35
topic := string(k)
36
subChan := ps.wrapped.SubOnce(topic)
37
- blockChannel := make(chan blocks.Block)
37
+ blockChannel := make(chan blocks.Block, 1) // buffered so the sender doesn't wait on receiver
38
go func() {
39
defer close(blockChannel)
40
select {