Fix stopping of nil Dispatcher (#2897)
The function value and parameters of a defer statement are immediately evaluated, so this "disp" value is always nil, and calling Stop() on a nil dispatcher is a no-op, so this does nothing, but wrapping it in a closure that refers to "disp" fixes it. Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
710588f10f
commit
a38c5b8f1d
|
@ -347,7 +347,9 @@ func run() int {
|
|||
defer alerts.Close()
|
||||
|
||||
var disp *dispatch.Dispatcher
|
||||
defer disp.Stop()
|
||||
defer func() {
|
||||
disp.Stop()
|
||||
}()
|
||||
|
||||
groupFn := func(routeFilter func(*dispatch.Route) bool, alertFilter func(*types.Alert, time.Time) bool) (dispatch.AlertGroups, map[model.Fingerprint][]string) {
|
||||
return disp.Groups(routeFilter, alertFilter)
|
||||
|
|
Loading…
Reference in New Issue