From 12ca0efc19fddbc5445c83332c2aa249baca09cd Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 22 Mar 2021 23:02:37 +0200 Subject: [PATCH] lib/storage: respect the deadline passed to Storage.SearchMetricNames --- lib/storage/storage.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/storage/storage.go b/lib/storage/storage.go index ffa096e66..5b6e478a5 100644 --- a/lib/storage/storage.go +++ b/lib/storage/storage.go @@ -938,6 +938,11 @@ func (s *Storage) SearchMetricNames(tfss []*TagFilters, tr TimeRange, maxMetrics mns := make([]MetricName, 0, len(tsids)) var metricName []byte for i := range tsids { + if i&paceLimiterSlowIterationsMask == 0 { + if err := checkSearchDeadlineAndPace(deadline); err != nil { + return nil, err + } + } metricID := tsids[i].MetricID var err error metricName, err = idb.searchMetricNameWithCache(metricName[:0], metricID, accountID, projectID)