delete actual reference first

This commit is contained in:
chrislu 2022-01-17 13:56:47 -08:00
parent 0ba88596e8
commit 381f4e73a0

View file

@ -146,10 +146,10 @@ func (cw *UploadPipeline) moveToSealed(memChunk *MemChunk, logicChunkIndex Logic
cw.saveOneChunk(sealedChunk.chunk, logicChunkIndex) cw.saveOneChunk(sealedChunk.chunk, logicChunkIndex)
// then remove from sealed chunks // then remove from sealed chunks
sealedChunk.FreeReference()
cw.sealedChunksLock.Lock() cw.sealedChunksLock.Lock()
defer cw.sealedChunksLock.Unlock() defer cw.sealedChunksLock.Unlock()
delete(cw.sealedChunks, logicChunkIndex) delete(cw.sealedChunks, logicChunkIndex)
sealedChunk.FreeReference()
atomic.AddInt32(&cw.activeWriterCount, -1) atomic.AddInt32(&cw.activeWriterCount, -1)
glog.V(4).Infof("activeWriterCount %d --> %d", cw.activeWriterCount+1, cw.activeWriterCount) glog.V(4).Infof("activeWriterCount %d --> %d", cw.activeWriterCount+1, cw.activeWriterCount)