lib/storage: respect the deadline passed to Storage.SearchMetricNames

This commit is contained in:
Aliaksandr Valialkin 2021-03-22 23:02:37 +02:00
parent 40e47935e7
commit 12ca0efc19

View file

@ -938,6 +938,11 @@ func (s *Storage) SearchMetricNames(tfss []*TagFilters, tr TimeRange, maxMetrics
mns := make([]MetricName, 0, len(tsids)) mns := make([]MetricName, 0, len(tsids))
var metricName []byte var metricName []byte
for i := range tsids { for i := range tsids {
if i&paceLimiterSlowIterationsMask == 0 {
if err := checkSearchDeadlineAndPace(deadline); err != nil {
return nil, err
}
}
metricID := tsids[i].MetricID metricID := tsids[i].MetricID
var err error var err error
metricName, err = idb.searchMetricNameWithCache(metricName[:0], metricID, accountID, projectID) metricName, err = idb.searchMetricNameWithCache(metricName[:0], metricID, accountID, projectID)