Merge pull request #9207 from filecoin-project/asr/deflake
fix: mock sealer: grab lock in ReadPiece
This commit is contained in:
commit
f1f31d1067
@ -439,6 +439,9 @@ func (mgr *SectorMgr) GenerateWindowPoStWithVanilla(ctx context.Context, proofTy
|
||||
func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) {
|
||||
off := storiface.UnpaddedByteIndex(0)
|
||||
var piece cid.Cid
|
||||
|
||||
mgr.lk.Lock()
|
||||
|
||||
for _, c := range mgr.sectors[sector.ID].pieces {
|
||||
piece = c
|
||||
if off >= offset {
|
||||
@ -451,6 +454,8 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef,
|
||||
}
|
||||
br := bytes.NewReader(mgr.pieces[piece][:size])
|
||||
|
||||
mgr.lk.Unlock()
|
||||
|
||||
return struct {
|
||||
io.ReadCloser
|
||||
io.Seeker
|
||||
|
Loading…
Reference in New Issue
Block a user