fix notification dispatcher panic when dispatching on program exit

This commit is contained in:
yusing 2025-01-23 04:41:10 +08:00
parent f7eb80a6ea
commit 66db583432

View file

@ -49,7 +49,12 @@ func Notify(msg *LogMessage) {
if dispatcher == nil { if dispatcher == nil {
return return
} }
dispatcher.logCh <- msg select {
case <-dispatcher.task.Context().Done():
return
default:
dispatcher.logCh <- msg
}
} }
func (disp *Dispatcher) RegisterProvider(cfg types.NotificationConfig) (Provider, E.Error) { func (disp *Dispatcher) RegisterProvider(cfg types.NotificationConfig) (Provider, E.Error) {