app/vmselect/searchutils: do not print flag name responsible for query timeout if the timeout isn't reached

This should make the log message more clear
This commit is contained in:
Aliaksandr Valialkin 2022-12-08 13:07:30 -08:00
parent bce1c5d572
commit f9730676d9
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -209,7 +209,7 @@ func (d *Deadline) String() string {
startTime := time.Unix(int64(d.deadline), 0).Add(-d.timeout)
elapsed := time.Since(startTime)
msg := fmt.Sprintf("%.3f seconds (elapsed %.3f seconds)", d.timeout.Seconds(), elapsed.Seconds())
if d.flagHint != "" {
if float64(elapsed)/float64(d.timeout) > 0.9 && d.flagHint != "" {
msg += fmt.Sprintf("; the timeout can be adjusted with `%s` command-line flag", d.flagHint)
}
return msg