rename variable

This commit is contained in:
chrislu 2022-09-14 00:06:54 -07:00
parent f8ef25099c
commit 58d18b68d8

View file

@ -120,11 +120,11 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
} }
var count int var count int
var needleSize types.Size var memoryCost types.Size
readOption.AttemptMetaOnly, readOption.MustMetaOnly = shouldAttemptStreamWrite(hasVolume, ext, r) readOption.AttemptMetaOnly, readOption.MustMetaOnly = shouldAttemptStreamWrite(hasVolume, ext, r)
onReadSizeFn := func(size types.Size) { onReadSizeFn := func(size types.Size) {
needleSize = size memoryCost = size
atomic.AddInt64(&vs.inFlightDownloadDataSize, int64(needleSize)) atomic.AddInt64(&vs.inFlightDownloadDataSize, int64(memoryCost))
} }
if hasVolume { if hasVolume {
count, err = vs.store.ReadVolumeNeedle(volumeId, n, readOption, onReadSizeFn) 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) count, err = vs.store.ReadEcShardNeedle(volumeId, n, onReadSizeFn)
} }
defer func() { defer func() {
atomic.AddInt64(&vs.inFlightDownloadDataSize, -int64(needleSize)) atomic.AddInt64(&vs.inFlightDownloadDataSize, -int64(memoryCost))
vs.inFlightDownloadDataLimitCond.Signal() vs.inFlightDownloadDataLimitCond.Signal()
}() }()