sealing: Rename Sealing.creating to a less confusing name

This commit is contained in:
Łukasz Magiera 2022-03-16 21:29:57 +01:00
parent 5e14892ef8
commit d78f1e4eee
2 changed files with 6 additions and 6 deletions

View File

@ -33,8 +33,8 @@ func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) e
m.inputLk.Lock() m.inputLk.Lock()
if m.creating != nil && *m.creating == sector.SectorNumber { if m.nextDealSector != nil && *m.nextDealSector == sector.SectorNumber {
m.creating = nil m.nextDealSector = nil
} }
sid := m.minerSectorID(sector.SectorNumber) sid := m.minerSectorID(sector.SectorNumber)
@ -615,14 +615,14 @@ func (m *Sealing) tryGetUpgradeSector(ctx context.Context, sp abi.RegisteredSeal
log.Infow("Upgrading sector", "number", candidate.Number, "type", "deal", "proofType", sp, "expiration", bestExpiration, "pledge", types.FIL(bestPledge)) log.Infow("Upgrading sector", "number", candidate.Number, "type", "deal", "proofType", sp, "expiration", bestExpiration, "pledge", types.FIL(bestPledge))
delete(m.available, candidate) delete(m.available, candidate)
m.creating = &candidate.Number m.nextDealSector = &candidate.Number
return true, m.sectors.Send(uint64(candidate.Number), SectorStartCCUpdate{}) return true, m.sectors.Send(uint64(candidate.Number), SectorStartCCUpdate{})
} }
func (m *Sealing) tryGetDealSector(ctx context.Context, sp abi.RegisteredSealProof, ef expFn) error { func (m *Sealing) tryGetDealSector(ctx context.Context, sp abi.RegisteredSealProof, ef expFn) error {
m.startupWait.Wait() m.startupWait.Wait()
if m.creating != nil { if m.nextDealSector != nil {
return nil // new sector is being created right now return nil // new sector is being created right now
} }
@ -656,7 +656,7 @@ func (m *Sealing) tryGetDealSector(ctx context.Context, sp abi.RegisteredSealPro
return err return err
} }
m.creating = &sid m.nextDealSector = &sid
log.Infow("Creating sector", "number", sid, "type", "deal", "proofType", sp) log.Infow("Creating sector", "number", sid, "type", "deal", "proofType", sp)
return m.sectors.Send(uint64(sid), SectorStart{ return m.sectors.Send(uint64(sid), SectorStart{

View File

@ -105,7 +105,7 @@ type Sealing struct {
sectorTimers map[abi.SectorID]*time.Timer sectorTimers map[abi.SectorID]*time.Timer
pendingPieces map[cid.Cid]*pendingPiece pendingPieces map[cid.Cid]*pendingPiece
assignedPieces map[abi.SectorID][]cid.Cid assignedPieces map[abi.SectorID][]cid.Cid
creating *abi.SectorNumber // used to prevent a race where we could create a new sector more than once nextDealSector *abi.SectorNumber // used to prevent a race where we could create a new sector more than once
upgradeLk sync.Mutex upgradeLk sync.Mutex
toUpgrade map[abi.SectorNumber]struct{} toUpgrade map[abi.SectorNumber]struct{}