mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 00:39:31 +08:00
avoid publishing if notification system has been shut down
(will deadlock) License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
@ -36,6 +36,16 @@ type impl struct {
|
||||
}
|
||||
|
||||
func (ps *impl) Publish(block blocks.Block) {
|
||||
ps.wg.Add(1)
|
||||
defer ps.wg.Done()
|
||||
|
||||
select {
|
||||
case <-ps.cancel:
|
||||
// Already shutdown, bail.
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
ps.wrapped.Pub(block, block.Cid().KeyString())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user