From ea271600ec732872ae3810cc85d72f4c6e17a17e Mon Sep 17 00:00:00 2001 From: chrislu Date: Tue, 4 Oct 2022 12:36:05 -0700 Subject: [PATCH] fix parameters --- weed/replication/sink/filersink/fetch_write.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/weed/replication/sink/filersink/fetch_write.go b/weed/replication/sink/filersink/fetch_write.go index 00a48d41a..2acad9e63 100644 --- a/weed/replication/sink/filersink/fetch_write.go +++ b/weed/replication/sink/filersink/fetch_write.go @@ -24,16 +24,15 @@ func (fs *FilerSink) replicateChunks(sourceChunks []*filer_pb.FileChunk, path st var wg sync.WaitGroup for chunkIndex, sourceChunk := range sourceChunks { wg.Add(1) + index, source := chunkIndex, sourceChunk fs.executor.Execute(func() { - func(chunk *filer_pb.FileChunk, index int) { - defer wg.Done() - replicatedChunk, e := fs.replicateOneChunk(chunk, path) - if e != nil { - err = e - return - } - replicatedChunks[index] = replicatedChunk - }(sourceChunk, chunkIndex) + defer wg.Done() + replicatedChunk, e := fs.replicateOneChunk(source, path) + if e != nil { + err = e + return + } + replicatedChunks[index] = replicatedChunk }) } wg.Wait()