Browse Source

filer: remove unnecessary code

- Remove close(s.cacheStartedCh) in destroy() - the channel is only used
  for one-time synchronization, closing it provides no benefit
- Remove task := task loop variable capture - Go 1.22+ fixed loop variable
  semantics, this capture is no longer necessary (go.mod specifies Go 1.24.0)
pull/7627/head
chrislu 5 days ago
parent
commit
2b7be3547b
  1. 1
      weed/filer/reader_at.go
  2. 1
      weed/filer/reader_cache.go

1
weed/filer/reader_at.go

@ -267,7 +267,6 @@ func (c *ChunkReadAt) doReadAt(ctx context.Context, p []byte, offset int64) (n i
g.SetLimit(concurrency)
for _, task := range tasks {
task := task // capture for closure
g.Go(func() error {
// Read directly into the correct position in the output buffer
copied, readErr := c.readChunkSliceAtForParallel(gCtx, p[task.bufferStart:task.bufferEnd], task.chunk, task.chunkOffset)

1
weed/filer/reader_cache.go

@ -223,7 +223,6 @@ func (s *SingleChunkCacher) destroy() {
if s.data != nil {
mem.Free(s.data)
s.data = nil
close(s.cacheStartedCh)
}
}

Loading…
Cancel
Save