guard with ctx

This commit is contained in:
Aarsh Shah 2022-02-21 11:56:49 +04:00
parent 26707a5e03
commit 1245871004

View File

@ -340,8 +340,12 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
} }
}() }()
res := <-resCh select {
case res := <-resCh:
return api.SectorOffset{Sector: res.sn, Offset: res.offset.Padded()}, res.err return api.SectorOffset{Sector: res.sn, Offset: res.offset.Padded()}, res.err
case <-ctx.Done():
return api.SectorOffset{}, ctx.Err()
}
} }
func (m *Sealing) MatchPendingPiecesToOpenSectors(ctx context.Context) error { func (m *Sealing) MatchPendingPiecesToOpenSectors(ctx context.Context) error {