lpproof treed: defer workWg.Done

This commit is contained in:
Łukasz Magiera 2024-02-21 13:33:49 +01:00
parent 91d3edecfd
commit 3b5165358a

View File

@ -176,6 +176,8 @@ func BuildTreeD(data io.Reader, unpaddedData bool, outPath string, size abi.Padd
// start processing // start processing
workWg.Add(1) workWg.Add(1)
go func(startOffset uint64) { go func(startOffset uint64) {
defer workWg.Done()
if unpaddedData { if unpaddedData {
paddedBuf := pool.Get(int(abi.UnpaddedPieceSize(len(workBuffer[0])).Padded())) paddedBuf := pool.Get(int(abi.UnpaddedPieceSize(len(workBuffer[0])).Padded()))
fr32.PadSingle(workBuffer[0], paddedBuf) fr32.PadSingle(workBuffer[0], paddedBuf)
@ -214,8 +216,6 @@ func BuildTreeD(data io.Reader, unpaddedData bool, outPath string, size abi.Padd
bufLk.Lock() bufLk.Lock()
workerBuffers = append(workerBuffers, workBuffer) workerBuffers = append(workerBuffers, workBuffer)
bufLk.Unlock() bufLk.Unlock()
workWg.Done()
}(processed) }(processed)
processed += processedSize processed += processedSize