mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-26 21:22:33 -08:00
Additional simplifications.
This commit is contained in:
parent
fd47ac570f
commit
73b463e814
|
@ -404,15 +404,12 @@ func optimizeForward(pending ops) (out ops) {
|
||||||
from = next.from
|
from = next.from
|
||||||
)
|
)
|
||||||
|
|
||||||
for {
|
for !from.After(next.through) {
|
||||||
from = from.Add(t.interval)
|
from = from.Add(t.interval)
|
||||||
|
|
||||||
if from.After(next.through) {
|
|
||||||
after.from = from
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
after.from = from
|
||||||
|
|
||||||
pending = append(ops{&before, &after}, pending...)
|
pending = append(ops{&before, &after}, pending...)
|
||||||
sort.Sort(startsAtSort{pending})
|
sort.Sort(startsAtSort{pending})
|
||||||
|
|
||||||
|
@ -451,17 +448,15 @@ func optimizeForward(pending ops) (out ops) {
|
||||||
|
|
||||||
if next.GreedierThan(t) {
|
if next.GreedierThan(t) {
|
||||||
var (
|
var (
|
||||||
t = next.from
|
nextStart = next.from
|
||||||
)
|
)
|
||||||
for {
|
|
||||||
t = t.Add(next.interval)
|
|
||||||
|
|
||||||
if t.After(next.through) {
|
for !nextStart.After(next.through) {
|
||||||
next.from = t
|
nextStart = nextStart.Add(next.interval)
|
||||||
|
|
||||||
tail = append(ops{next}, pending...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
next.from = nextStart
|
||||||
|
tail = append(ops{next}, pending...)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
panic("unknown operation type")
|
panic("unknown operation type")
|
||||||
|
|
Loading…
Reference in a new issue