Always flush when timer goes off
This commit is contained in:
parent
9e4875f210
commit
6ca2a14819
12
extern/storage-sealing/commit_batch.go
vendored
12
extern/storage-sealing/commit_batch.go
vendored
@ -108,7 +108,7 @@ func (b *CommitBatcher) run() {
|
||||
}
|
||||
lastMsg = nil
|
||||
|
||||
var sendAboveMax, sendAboveMin bool
|
||||
var sendAboveMax bool
|
||||
select {
|
||||
case <-b.stop:
|
||||
close(b.stopped)
|
||||
@ -116,13 +116,13 @@ func (b *CommitBatcher) run() {
|
||||
case <-b.notify:
|
||||
sendAboveMax = true
|
||||
case <-b.batchWait(cfg.CommitBatchWait, cfg.CommitBatchSlack):
|
||||
sendAboveMin = true
|
||||
// do nothing
|
||||
case fr := <-b.force: // user triggered
|
||||
forceRes = fr
|
||||
}
|
||||
|
||||
var err error
|
||||
lastMsg, err = b.maybeStartBatch(sendAboveMax, sendAboveMin)
|
||||
lastMsg, err = b.maybeStartBatch(sendAboveMax)
|
||||
if err != nil {
|
||||
log.Warnw("CommitBatcher processBatch error", "error", err)
|
||||
}
|
||||
@ -170,7 +170,7 @@ func (b *CommitBatcher) batchWait(maxWait, slack time.Duration) <-chan time.Time
|
||||
return time.After(wait)
|
||||
}
|
||||
|
||||
func (b *CommitBatcher) maybeStartBatch(notif, after bool) ([]sealiface.CommitBatchRes, error) {
|
||||
func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes, error) {
|
||||
b.lk.Lock()
|
||||
defer b.lk.Unlock()
|
||||
|
||||
@ -188,10 +188,6 @@ func (b *CommitBatcher) maybeStartBatch(notif, after bool) ([]sealiface.CommitBa
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if after && total < cfg.MinCommitBatch {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var res []sealiface.CommitBatchRes
|
||||
|
||||
if total < cfg.MinCommitBatch || total < miner5.MinAggregatedSectors {
|
||||
|
Loading…
Reference in New Issue
Block a user