Merge pull request #10648 from filecoin-project/vyzo/fix/mpool-prune-select
fix:mpool: prune excess messages before selection
This commit is contained in:
commit
a7379e2cce
@ -47,6 +47,16 @@ func (mp *MessagePool) SelectMessages(ctx context.Context, ts *types.TipSet, tq
|
|||||||
mp.lk.Lock()
|
mp.lk.Lock()
|
||||||
defer mp.lk.Unlock()
|
defer mp.lk.Unlock()
|
||||||
|
|
||||||
|
// See if we need to prune before selection; excessive buildup can lead to slow selection,
|
||||||
|
// so prune if we have too many messages (ignoring the cooldown).
|
||||||
|
mpCfg := mp.getConfig()
|
||||||
|
if mp.currentSize > mpCfg.SizeLimitHigh {
|
||||||
|
log.Infof("too many messages; pruning before selection")
|
||||||
|
if err := mp.pruneMessages(ctx, ts); err != nil {
|
||||||
|
log.Warnf("error pruning excess messages: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if the ticket quality is high enough that the first block has higher probability
|
// if the ticket quality is high enough that the first block has higher probability
|
||||||
// than any other block, then we don't bother with optimal selection because the
|
// than any other block, then we don't bother with optimal selection because the
|
||||||
// first block will always have higher effective performance
|
// first block will always have higher effective performance
|
||||||
|
Loading…
Reference in New Issue
Block a user