mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
wrap exec instead
This commit is contained in:
parent
da6df521c7
commit
c335e56e03
1 changed files with 10 additions and 6 deletions
|
@ -78,24 +78,28 @@ func (c *ClientWorker) Run(pace bool, worker *FileWorker) {
|
|||
time.Sleep(lag)
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
c.pipe.Do(context.Background(), msg.values...).Result()
|
||||
latency := float64(time.Since(start).Microseconds())
|
||||
worker.latencyMu.Lock()
|
||||
worker.latencyDigest.Add(latency, 1)
|
||||
worker.latencyMu.Unlock()
|
||||
|
||||
atomic.AddUint64(&worker.processed, 1)
|
||||
|
||||
if msg.HasMore == 0 {
|
||||
size := c.pipe.Len()
|
||||
start := time.Now()
|
||||
c.pipe.Exec(context.Background())
|
||||
batchLatency := float64(time.Since(start).Microseconds())
|
||||
worker.latencyMu.Lock()
|
||||
worker.latencyDigest.Add(batchLatency, 1)
|
||||
worker.latencyMu.Unlock()
|
||||
c.processed += uint(size)
|
||||
}
|
||||
}
|
||||
|
||||
if size := c.pipe.Len(); size >= 0 {
|
||||
start := time.Now()
|
||||
c.pipe.Exec(context.Background())
|
||||
batchLatency := float64(time.Since(start).Microseconds())
|
||||
worker.latencyMu.Lock()
|
||||
worker.latencyDigest.Add(batchLatency, 1)
|
||||
worker.latencyMu.Unlock()
|
||||
c.processed += uint(size)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue