improve remote storage enqueue performance (#4772)

Signed-off-by: fyc <fyc22788@ly.com>
This commit is contained in:
fengyuceNv 2018-11-13 20:19:05 +08:00 committed by Tom Wilkie
parent 8edaa8ad4d
commit 94fff219ab
1 changed files with 3 additions and 3 deletions

View File

@ -149,7 +149,7 @@ type QueueManager struct {
queueName string
logLimiter *rate.Limiter
shardsMtx sync.Mutex
shardsMtx sync.RWMutex
shards *shards
numShards int
reshardChan chan int
@ -218,9 +218,9 @@ func (t *QueueManager) Append(s *model.Sample) error {
return nil
}
t.shardsMtx.Lock()
t.shardsMtx.RLock()
enqueued := t.shards.enqueue(&snew)
t.shardsMtx.Unlock()
t.shardsMtx.RUnlock()
if enqueued {
queueLength.WithLabelValues(t.queueName).Inc()