fix possible mempool deadlock
This commit is contained in:
parent
c777be256a
commit
98b0c51b5f
|
@ -72,8 +72,8 @@ type Mempool struct {
|
||||||
rechecking int32 // for re-checking filtered txs on Update()
|
rechecking int32 // for re-checking filtered txs on Update()
|
||||||
recheckCursor *clist.CElement // next expected response
|
recheckCursor *clist.CElement // next expected response
|
||||||
recheckEnd *clist.CElement // re-checking stops here
|
recheckEnd *clist.CElement // re-checking stops here
|
||||||
notifiedTxsAvailable bool // true if fired on txsAvailable for this height
|
notifiedTxsAvailable bool
|
||||||
txsAvailable chan int64 // fires the next height once for each height, when the mempool is not empty
|
txsAvailable chan int64 // fires the next height once for each height, when the mempool is not empty
|
||||||
|
|
||||||
// Keep a cache of already-seen txs.
|
// Keep a cache of already-seen txs.
|
||||||
// This reduces the pressure on the proxyApp.
|
// This reduces the pressure on the proxyApp.
|
||||||
|
@ -328,8 +328,12 @@ func (mem *Mempool) notifyTxsAvailable() {
|
||||||
panic("notified txs available but mempool is empty!")
|
panic("notified txs available but mempool is empty!")
|
||||||
}
|
}
|
||||||
if mem.txsAvailable != nil && !mem.notifiedTxsAvailable {
|
if mem.txsAvailable != nil && !mem.notifiedTxsAvailable {
|
||||||
|
select {
|
||||||
|
case mem.txsAvailable <- mem.height + 1:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
mem.notifiedTxsAvailable = true
|
mem.notifiedTxsAvailable = true
|
||||||
mem.txsAvailable <- mem.height + 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue