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:
parent
ddc46fc059
commit
9da58c5f6a
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user