app/vmselect/prometheus: consistently apply nocache arg to /api/v1/query the same way ast to /api/v1/query_range

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/241
This commit is contained in:
Aliaksandr Valialkin 2019-11-26 22:55:23 +02:00
parent e0ac068112
commit def9ccd360

View file

@ -554,7 +554,9 @@ func QueryHandler(at *auth.Token, w http.ResponseWriter, r *http.Request) error
if len(query) > *maxQueryLen {
return fmt.Errorf(`too long query; got %d bytes; mustn't exceed %d bytes`, len(query), *maxQueryLen)
}
if ct-start < queryOffset {
if !getBool(r, "nocache") && ct-start < queryOffset {
// Adjust start time only if `nocache` arg isn't set.
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/241
start = ct - queryOffset
}
if childQuery, windowStr, offsetStr := promql.IsMetricSelectorWithRollup(query); childQuery != "" {