storageminer: Restart sealing on restart
This commit is contained in:
parent
6c25c5384d
commit
922d8a90a5
@ -88,6 +88,10 @@ func (sb *SectorBuilder) SealSector(sectorID uint64, ticket SealTicket) (SealedS
|
||||
return sectorbuilder.SealSector(sb.handle, sectorID, ticket)
|
||||
}
|
||||
|
||||
func (sb *SectorBuilder) ResumeSealSector(sectorID uint64) (SealedSectorMetadata, error) {
|
||||
return sectorbuilder.ResumeSealSector(sb.handle, sectorID)
|
||||
}
|
||||
|
||||
func (sb *SectorBuilder) SealStatus(sector uint64) (SectorSealingStatus, error) {
|
||||
return sectorbuilder.GetSectorSealingStatusByID(sb.handle, sector)
|
||||
}
|
||||
|
@ -107,9 +107,39 @@ func (s *Store) poll() {
|
||||
s.waitingLk.Unlock()
|
||||
}
|
||||
|
||||
func (s *Store) restartSealing() {
|
||||
sectors, err := s.sb.GetAllStagedSectors()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, sid := range sectors {
|
||||
status, err := s.sb.SealStatus(sid)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if status.State != sealing_state.Paused {
|
||||
continue
|
||||
}
|
||||
|
||||
log.Infof("Sector %d is in paused state, resuming sealing", sid)
|
||||
go func() {
|
||||
// TODO: when we refactor wait-for-seal below, care about this output too
|
||||
// (see SealSector below)
|
||||
_, err := s.sb.ResumeSealSector(sid)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Store) service() {
|
||||
poll := time.Tick(5 * time.Second)
|
||||
|
||||
s.restartSealing()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-poll:
|
||||
|
Loading…
Reference in New Issue
Block a user