Update the runShard method and change len(pendingSamples) to n=len(pendingSamples) (#5708)

Signed-off-by: xigang <wangxigang2014@gmail.com>
This commit is contained in:
Xigang Wang 2019-07-10 02:09:11 +08:00 committed by Tom Wilkie
parent fc3b772342
commit 445bcd1251
1 changed files with 3 additions and 3 deletions

View File

@ -680,9 +680,9 @@ func (s *shards) runShard(ctx context.Context, i int, queue chan prompb.TimeSeri
}
case <-timer.C:
if len(pendingSamples) > 0 {
level.Debug(s.qm.logger).Log("msg", "runShard timer ticked, sending samples", "samples", len(pendingSamples), "shard", shardNum)
n := len(pendingSamples)
n := len(pendingSamples)
if n > 0 {
level.Debug(s.qm.logger).Log("msg", "runShard timer ticked, sending samples", "samples", n, "shard", shardNum)
s.sendSamples(ctx, pendingSamples, &buf)
pendingSamples = pendingSamples[:0]
s.qm.pendingSamplesMetric.Sub(float64(n))