feat: wdpost: Envvar for limiting recovering sectors
This commit is contained in:
parent
a843c52e38
commit
c215a03edd
@ -2,6 +2,8 @@ package wdpost
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
@ -19,6 +21,18 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var recoveringSectorLimit int64 = 0
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if rcl := os.Getenv("LOTUS_RECOVERING_SECTOR_LIMIT"); rcl != "" {
|
||||||
|
var err error
|
||||||
|
recoveringSectorLimit, err = strconv.ParseInt(rcl, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorw("parsing LOTUS_RECOVERING_SECTOR_LIMIT", "error", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// declareRecoveries identifies sectors that were previously marked as faulty
|
// declareRecoveries identifies sectors that were previously marked as faulty
|
||||||
// for our miner, but are now recovered (i.e. are now provable again) and
|
// for our miner, but are now recovered (i.e. are now provable again) and
|
||||||
// still not reported as such.
|
// still not reported as such.
|
||||||
@ -90,6 +104,11 @@ func (s *WindowPoStScheduler) declareRecoveries(ctx context.Context, dlIdx uint6
|
|||||||
Sectors: recovered,
|
Sectors: recovered,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if recoveringSectorLimit > 0 && int64(totalRecoveries) >= recoveringSectorLimit {
|
||||||
|
log.Errorw("reached recovering sector limit, not all sectors will be marked as recovered")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
totalRecoveries++
|
totalRecoveries++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user