From 85ede6d64bf10ce9b91cdd6d80f87350ee55242f Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 4 Jan 2022 14:07:04 +0000 Subject: [PATCH] Fix panics on closed channel sends --- roomserver/internal/input/input.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roomserver/internal/input/input.go b/roomserver/internal/input/input.go index 857dbe1c0..acffde5d6 100644 --- a/roomserver/internal/input/input.go +++ b/roomserver/internal/input/input.go @@ -119,7 +119,11 @@ func (r *Inputer) InputRoomEvents( } else { hooks.Run(hooks.KindNewEventPersisted, inputRoomEvent.Event) } - responses <- err + select { + case <-ctx.Done(): + default: + responses <- err + } }) } for i := 0; i < len(request.InputRoomEvents); i++ {