From 58d18b68d8ca463cef2a817f69f62e7b2fbd61f0 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 14 Sep 2022 00:06:54 -0700 Subject: [PATCH] rename variable --- weed/server/volume_server_handlers_read.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go index ced473852..90f553116 100644 --- a/weed/server/volume_server_handlers_read.go +++ b/weed/server/volume_server_handlers_read.go @@ -120,11 +120,11 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) } var count int - var needleSize types.Size + var memoryCost types.Size readOption.AttemptMetaOnly, readOption.MustMetaOnly = shouldAttemptStreamWrite(hasVolume, ext, r) onReadSizeFn := func(size types.Size) { - needleSize = size - atomic.AddInt64(&vs.inFlightDownloadDataSize, int64(needleSize)) + memoryCost = size + atomic.AddInt64(&vs.inFlightDownloadDataSize, int64(memoryCost)) } if hasVolume { count, err = vs.store.ReadVolumeNeedle(volumeId, n, readOption, onReadSizeFn) @@ -132,7 +132,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) count, err = vs.store.ReadEcShardNeedle(volumeId, n, onReadSizeFn) } defer func() { - atomic.AddInt64(&vs.inFlightDownloadDataSize, -int64(needleSize)) + atomic.AddInt64(&vs.inFlightDownloadDataSize, -int64(memoryCost)) vs.inFlightDownloadDataLimitCond.Signal() }()