Terminate rule groups during initial sleep

When an evaluation group runs initially, it waits a deterministic
amount of time. During that time it also has to accept
a termination singnal so shutdown doesn't hang during the first
evaluation iteration after a configuration reload.

Fixes #1307
This commit is contained in:
Fabian Reinartz 2016-01-12 10:52:40 +01:00
parent 26eb3ac2f8
commit 6eee86dce8

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()