Merge pull request #1308 from prometheus/rulefix

Fix hanging shutdown shortly after restart
This commit is contained in:
Fabian Reinartz 2016-01-12 11:24:11 +01:00
commit 19e81f81a0
2 changed files with 9 additions and 1 deletions

View file

@ -123,7 +123,11 @@ func (g *Group) run() {
defer close(g.terminated)
// 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() {
start := time.Now()

View file

@ -55,6 +55,10 @@ func (rule RecordingRule) eval(timestamp model.Time, engine *promql.Engine) (mod
result = query.Exec()
vector model.Vector
)
if result.Err != nil {
return nil, err
}
switch result.Value.(type) {
case model.Vector:
vector, err = result.Vector()