From de4ab0d02cc1bb4e8f158f59f890ce19f2daf94e Mon Sep 17 00:00:00 2001 From: William Petit Date: Sat, 21 Oct 2023 21:38:34 +0200 Subject: [PATCH] fix(bus): prevent double close in event dispatcher --- pkg/bus/memory/event_dispatcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/bus/memory/event_dispatcher.go b/pkg/bus/memory/event_dispatcher.go index 2d60604..a078939 100644 --- a/pkg/bus/memory/event_dispatcher.go +++ b/pkg/bus/memory/event_dispatcher.go @@ -83,8 +83,12 @@ func (d *eventDispatcher) Close() { } func (d *eventDispatcher) close() { - d.closed = true + if d.closed { + return + } + close(d.in) + d.closed = true } func (d *eventDispatcher) In(msg bus.Message) (err error) {