From 1646edf51328bc29ba9f02363ebdf621129344ef Mon Sep 17 00:00:00 2001 From: zl Date: Mon, 28 Mar 2022 19:07:12 +0800 Subject: [PATCH] fix: dead loop on removing a sector --- extern/storage-sealing/fsm.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extern/storage-sealing/fsm.go b/extern/storage-sealing/fsm.go index a02666135..034433a59 100644 --- a/extern/storage-sealing/fsm.go +++ b/extern/storage-sealing/fsm.go @@ -320,7 +320,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto FaultReported: final, // not really supported right now FaultedFinal: final, - Removed: final, + Removed: finalRemoved, FailedUnrecoverable: final, } @@ -694,6 +694,12 @@ func (m *Sealing) ForceSectorState(ctx context.Context, id abi.SectorNumber, sta return m.sectors.Send(id, SectorForceState{state}) } +// as sector has been removed, it's no needs to care about later events, +// just returns length of events as `processed` is ok. +func finalRemoved(events []statemachine.Event, state *SectorInfo) (uint64, error) { + return uint64(len(events)), nil +} + func final(events []statemachine.Event, state *SectorInfo) (uint64, error) { if len(events) > 0 { if gm, ok := events[0].User.(globalMutator); ok {