mirror of
https://github.com/filecoin-project/lotus.git
synced 2025-08-26 02:38:58 +08:00
NewCommitBatcher now has an additional
error return to deal with errors arising from fetching the sealing config.
This commit is contained in:

committed by
Aarsh Shah

parent
a2b963a675
commit
7635d55412
@ -83,7 +83,7 @@ type CommitBatcher struct {
|
||||
lk sync.Mutex
|
||||
}
|
||||
|
||||
func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBatcherApi, addrSel AddressSelector, feeCfg config.MinerFeeConfig, getConfig dtypes.GetSealingConfigFunc, prov storiface.Prover) *CommitBatcher {
|
||||
func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBatcherApi, addrSel AddressSelector, feeCfg config.MinerFeeConfig, getConfig dtypes.GetSealingConfigFunc, prov storiface.Prover) (*CommitBatcher, error) {
|
||||
b := &CommitBatcher{
|
||||
api: api,
|
||||
maddr: maddr,
|
||||
@ -103,20 +103,20 @@ func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBat
|
||||
stopped: make(chan struct{}),
|
||||
}
|
||||
|
||||
go b.run()
|
||||
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *CommitBatcher) run() {
|
||||
var forceRes chan []sealiface.CommitBatchRes
|
||||
var lastMsg []sealiface.CommitBatchRes
|
||||
|
||||
cfg, err := b.getConfig()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go b.run(cfg)
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (b *CommitBatcher) run(cfg sealiface.Config) {
|
||||
var forceRes chan []sealiface.CommitBatchRes
|
||||
var lastMsg []sealiface.CommitBatchRes
|
||||
|
||||
timer := time.NewTimer(b.batchWait(cfg.CommitBatchWait, cfg.CommitBatchSlack))
|
||||
for {
|
||||
if forceRes != nil {
|
||||
|
Reference in New Issue
Block a user