Make flags more intuitive
This commit is contained in:
parent
66e8418125
commit
94c5076710
@ -575,14 +575,12 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
Usage: "Renew expiring sectors while not exceeding each sector's max life",
|
Usage: "Renew expiring sectors while not exceeding each sector's max life",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.Int64Flag{
|
&cli.Int64Flag{
|
||||||
Name: "lower-cutoff",
|
Name: "from",
|
||||||
Usage: "skip sectors whose current expiration is less than <lower-cutoff> epochs from now",
|
Usage: "only consider sectors whose current expiration epoch is in the range of [from, to], <from> defaults to: now + 120",
|
||||||
Value: 120,
|
|
||||||
},
|
},
|
||||||
&cli.Int64Flag{
|
&cli.Int64Flag{
|
||||||
Name: "upper-cutoff",
|
Name: "to",
|
||||||
Usage: "skip sectors whose current expiration is more than <upper-cutoff> epochs from now",
|
Usage: "only consider sectors whose current expiration epoch is in the range of [from, to], <to> defaults to: now + 86400",
|
||||||
Value: 86400,
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "sector-file",
|
Name: "sector-file",
|
||||||
@ -742,9 +740,19 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
from := currEpoch + 120
|
||||||
|
to := currEpoch + 86400
|
||||||
|
|
||||||
|
if cctx.IsSet("from") {
|
||||||
|
from = abi.ChainEpoch(cctx.Int64("from"))
|
||||||
|
}
|
||||||
|
|
||||||
|
if cctx.IsSet("to") {
|
||||||
|
to = abi.ChainEpoch(cctx.Int64("to"))
|
||||||
|
}
|
||||||
|
|
||||||
for _, si := range activeSet {
|
for _, si := range activeSet {
|
||||||
if si.Expiration >= currEpoch+abi.ChainEpoch(cctx.Int64("lower-cutoff")) &&
|
if si.Expiration >= from && si.Expiration <= to {
|
||||||
si.Expiration <= currEpoch+abi.ChainEpoch(cctx.Int64("upper-cutoff")) {
|
|
||||||
if _, exclude := excludeSet[uint64(si.SectorNumber)]; !exclude {
|
if _, exclude := excludeSet[uint64(si.SectorNumber)]; !exclude {
|
||||||
sis = append(sis, si)
|
sis = append(sis, si)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user