fix: mpool: avoid deadlock on unsubscribe

When unsubscribing _all_ topics, pubsub will drain the subscription
channel to avoid deadlocks. See
https://github.com/whyrusleeping/pubsub/pull/1.

fixes #7803
This commit is contained in:
Steven Allen
2022-05-10 16:52:17 -04:00
committed by Aayush Rajasekaran
parent ddc46fc059
commit 9da58c5f6a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1477,7 +1477,7 @@ func (mp *MessagePool) Updates(ctx context.Context) (<-chan api.MpoolUpdate, err
sub := mp.changes.Sub(localUpdates)
go func() {
defer mp.changes.Unsub(sub, localUpdates)
defer mp.changes.Unsub(sub)
defer close(out)
for {
+1 -1
View File
@@ -260,7 +260,7 @@ func (syncer *Syncer) IncomingBlocks(ctx context.Context) (<-chan *types.BlockHe
out := make(chan *types.BlockHeader, 10)
go func() {
defer syncer.incoming.Unsub(sub, LocalIncoming)
defer syncer.incoming.Unsub(sub)
for {
select {