storagefsm: Auto-retry failed remove

This commit is contained in:
Łukasz Magiera 2020-08-27 23:59:01 +02:00
parent 59d2034cbb
commit a6492b1ed6
2 changed files with 14 additions and 0 deletions

View File

@ -143,6 +143,9 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
on(SectorRemoved{}, Removed),
on(SectorRemoveFailed{}, RemoveFailed),
),
RemoveFailed: planOne(
// SectorRemove (global)
),
Faulty: planOne(
on(SectorFaultReported{}, FaultReported),
),
@ -304,6 +307,9 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
case Removed:
return nil, processed, nil
case RemoveFailed:
return m.handleRemoveFailed, processed, nil
// Faults
case Faulty:
return m.handleFaulty, processed, nil

View File

@ -244,6 +244,14 @@ func (m *Sealing) handleFinalizeFailed(ctx statemachine.Context, sector SectorIn
return ctx.Send(SectorRetryFinalize{})
}
func (m *Sealing) handleRemoveFailed(ctx statemachine.Context, sector SectorInfo) error {
if err := failedCooldown(ctx, sector); err != nil {
return err
}
return ctx.Send(SectorRemove{})
}
func (m *Sealing) handleDealsExpired(ctx statemachine.Context, sector SectorInfo) error {
// First make vary sure the sector isn't committed
si, err := m.api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, nil)