mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
console: fix intermittent failure when requesting previous period
Notably when the main table is required, but also on rare conditions when another table would be selected because of the interval selection. This is not perfect as sometimes, we won't have the data.
This commit is contained in:
@@ -215,19 +215,18 @@ func (c *Component) contextFunc(inputStr string) context {
|
||||
|
||||
func (c *Component) computeTableAndInterval(input inputContext) (string, time.Duration, time.Duration) {
|
||||
targetInterval := time.Duration(uint64(input.End.Sub(input.Start)) / uint64(input.Points))
|
||||
if targetInterval < time.Second {
|
||||
targetInterval = time.Second
|
||||
}
|
||||
targetInterval = max(targetInterval, time.Second)
|
||||
|
||||
// Select table
|
||||
targetIntervalForTableSelection := targetInterval
|
||||
if input.MainTableRequired {
|
||||
targetIntervalForTableSelection = time.Second
|
||||
}
|
||||
table, computedInterval := c.getBestTable(input.Start, targetIntervalForTableSelection)
|
||||
startForTableSelection := input.Start
|
||||
if input.StartForInterval != nil {
|
||||
_, computedInterval = c.getBestTable(*input.StartForInterval, targetIntervalForTableSelection)
|
||||
startForTableSelection = *input.StartForInterval
|
||||
}
|
||||
table, computedInterval := c.getBestTable(startForTableSelection, targetIntervalForTableSelection)
|
||||
return table, computedInterval, targetInterval
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user