Address review
This commit is contained in:
parent
1e53ed6a82
commit
80b8d4b9d7
@ -45,6 +45,7 @@ const MinSectorExpiration = miner0.MinSectorExpiration
|
|||||||
|
|
||||||
// Not used / checked in v0
|
// Not used / checked in v0
|
||||||
var DeclarationsMax = miner2.DeclarationsMax
|
var DeclarationsMax = miner2.DeclarationsMax
|
||||||
|
var AddressedSectorsMax = miner2.AddressedSectorsMax
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
|
21
extern/storage-sealing/terminate_batch.go
vendored
21
extern/storage-sealing/terminate_batch.go
vendored
@ -86,21 +86,21 @@ func (b *TerminateBatcher) run() {
|
|||||||
}
|
}
|
||||||
lastMsg = nil
|
lastMsg = nil
|
||||||
|
|
||||||
var notif, after bool
|
var sendAboveMax, sendAboveMin bool
|
||||||
select {
|
select {
|
||||||
case <-b.stop:
|
case <-b.stop:
|
||||||
close(b.stopped)
|
close(b.stopped)
|
||||||
return
|
return
|
||||||
case <-b.notify:
|
case <-b.notify:
|
||||||
notif = true // send above max
|
sendAboveMax = true
|
||||||
case <-time.After(TerminateBatchWait):
|
case <-time.After(TerminateBatchWait):
|
||||||
after = true // send above min
|
sendAboveMin = true
|
||||||
case fr := <-b.force: // user triggered
|
case fr := <-b.force: // user triggered
|
||||||
forceRes = fr
|
forceRes = fr
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
lastMsg, err = b.processBatch(notif, after)
|
lastMsg, err = b.processBatch(sendAboveMax, sendAboveMin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnw("TerminateBatcher processBatch error", "error", err)
|
log.Warnw("TerminateBatcher processBatch error", "error", err)
|
||||||
}
|
}
|
||||||
@ -143,8 +143,8 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if total+n > uint64(miner.DeclarationsMax) {
|
if total+n > uint64(miner.AddressedSectorsMax) {
|
||||||
n = uint64(miner.DeclarationsMax) - total
|
n = uint64(miner.AddressedSectorsMax) - total
|
||||||
|
|
||||||
toTerminate, err = toTerminate.Slice(0, n)
|
toTerminate, err = toTerminate.Slice(0, n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -152,11 +152,12 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
*sectors, err = bitfield.SubtractBitField(*sectors, toTerminate)
|
s, err := bitfield.SubtractBitField(*sectors, toTerminate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnw("TerminateBatcher: sectors-toTerminate", "deadline", loc.Deadline, "partition", loc.Partition, "error", err)
|
log.Warnw("TerminateBatcher: sectors-toTerminate", "deadline", loc.Deadline, "partition", loc.Partition, "error", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
*sectors = s
|
||||||
}
|
}
|
||||||
|
|
||||||
total += n
|
total += n
|
||||||
@ -167,7 +168,11 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
|||||||
Sectors: toTerminate,
|
Sectors: toTerminate,
|
||||||
})
|
})
|
||||||
|
|
||||||
if total >= uint64(miner.DeclarationsMax) {
|
if total >= uint64(miner.AddressedSectorsMax) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(params.Terminations) >= miner.DeclarationsMax {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user