This commit is contained in:
Aliaksandr Valialkin 2024-04-30 23:17:24 +02:00
parent 56c115c455
commit 45639b1400
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
2 changed files with 4 additions and 1 deletions

View file

@ -296,6 +296,7 @@ func (spp *pipeStatsProcessor) flush() error {
var values []string
var br blockResult
zeroTimestamps := []int64{0}
for key, spg := range m {
// m may be quite big, so this loop can take a lot of time and CPU.
// Stop processing data as soon as stopCh is closed without wasting additional CPU time.
@ -321,6 +322,7 @@ func (spp *pipeStatsProcessor) flush() error {
}
br.reset()
br.timestamps = zeroTimestamps
// construct columns for byFields
for i, f := range byFields {

View file

@ -68,7 +68,8 @@ func (s *Storage) RunQuery(ctx context.Context, tenantIDs []TenantID, q *Query,
csDst := brs.cs
csSrc := br.getColumns()
for _, c := range csSrc {
for i := range csSrc {
c := &csSrc[i]
values := c.getValues(br)
csDst = append(csDst, BlockColumn{
Name: c.name,