From 4db8a5f17d12ae4b29d3d0ad8b4891477f24c1ab Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 28 Jul 2023 13:23:45 +0200 Subject: fix deadlock when ordering the broadcasted events Do not increment the global event id when sending "private" events like the initial commands and search results. Fixes: a93c5826172f835db604a2646d470ecfd72484cf --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 2c19a67..8c70976 100644 --- a/main.go +++ b/main.go @@ -99,11 +99,13 @@ func searchHandler(w http.ResponseWriter, r *http.Request) { go func() { for result := range resultsChan { if len(result) > 0 { - conn.Send(wrms.newPrivateEvent(searchId, "search", result)) + // We can send the search results directly without going through the ordered channel + conn._sendEv(wrms.newPrivateEvent(searchId, "search", result)) } } - conn.Send(wrms.newPrivateEvent(searchId, "finish-search", nil)) + // We can send the search results directly without going through the ordered channel + conn._sendEv(wrms.newPrivateEvent(searchId, "finish-search", nil)) llog.Debug("searching for %v took %v", searchQuery, time.Since(start)) }() -- cgit v1.2.3