From 38350b8d8a9fd4bfed0cd65732b3ed8097919215 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Wed, 16 Aug 2023 17:20:39 -0400 Subject: [PATCH] Run unsealing in the background for better ux --- node/impl/storminer.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node/impl/storminer.go b/node/impl/storminer.go index e4fa41c78..e88c87256 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -278,7 +278,13 @@ func (sm *StorageMinerAPI) SectorUnseal(ctx context.Context, sectorNum abi.Secto ProofType: status.SealProof, } - return sm.StorageMgr.SectorsUnsealPiece(ctx, sector, storiface.UnpaddedByteIndex(0), abi.UnpaddedPieceSize(0), status.Ticket.Value, status.CommD) + bgCtx := context.Background() + + go func() { + sm.StorageMgr.SectorsUnsealPiece(bgCtx, sector, storiface.UnpaddedByteIndex(0), abi.UnpaddedPieceSize(0), status.Ticket.Value, status.CommD) + }() + + return nil } // List all staged sectors