mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-28 15:09:39 -08:00
Merge pull request #1308 from prometheus/rulefix
Fix hanging shutdown shortly after restart
This commit is contained in:
commit
19e81f81a0
|
@ -123,7 +123,11 @@ func (g *Group) run() {
|
||||||
defer close(g.terminated)
|
defer close(g.terminated)
|
||||||
|
|
||||||
// Wait an initial amount to have consistently slotted intervals.
|
// Wait an initial amount to have consistently slotted intervals.
|
||||||
time.Sleep(g.offset())
|
select {
|
||||||
|
case <-time.After(g.offset()):
|
||||||
|
case <-g.done:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
iter := func() {
|
iter := func() {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
|
@ -55,6 +55,10 @@ func (rule RecordingRule) eval(timestamp model.Time, engine *promql.Engine) (mod
|
||||||
result = query.Exec()
|
result = query.Exec()
|
||||||
vector model.Vector
|
vector model.Vector
|
||||||
)
|
)
|
||||||
|
if result.Err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
switch result.Value.(type) {
|
switch result.Value.(type) {
|
||||||
case model.Vector:
|
case model.Vector:
|
||||||
vector, err = result.Vector()
|
vector, err = result.Vector()
|
||||||
|
|
Loading…
Reference in a new issue