From 3b5165358af3f258430854da2f6a49663c35da52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 21 Feb 2024 13:33:49 +0100 Subject: [PATCH] lpproof treed: defer workWg.Done --- provider/lpproof/treed_build.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provider/lpproof/treed_build.go b/provider/lpproof/treed_build.go index 1fe0d2f0d..12d0ee93e 100644 --- a/provider/lpproof/treed_build.go +++ b/provider/lpproof/treed_build.go @@ -176,6 +176,8 @@ func BuildTreeD(data io.Reader, unpaddedData bool, outPath string, size abi.Padd // start processing workWg.Add(1) go func(startOffset uint64) { + defer workWg.Done() + if unpaddedData { paddedBuf := pool.Get(int(abi.UnpaddedPieceSize(len(workBuffer[0])).Padded())) fr32.PadSingle(workBuffer[0], paddedBuf) @@ -214,8 +216,6 @@ func BuildTreeD(data io.Reader, unpaddedData bool, outPath string, size abi.Padd bufLk.Lock() workerBuffers = append(workerBuffers, workBuffer) bufLk.Unlock() - - workWg.Done() }(processed) processed += processedSize