aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-07-28 13:23:45 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-07-28 13:23:45 +0200
commit4db8a5f17d12ae4b29d3d0ad8b4891477f24c1ab (patch)
treed562d489bda5c030052614b310030080c4158f24 /main.go
parent1c359d89b95e59eb0d0cda76eccc8e64c323d078 (diff)
downloadWRMS-4db8a5f17d12ae4b29d3d0ad8b4891477f24c1ab.tar.gz
WRMS-4db8a5f17d12ae4b29d3d0ad8b4891477f24c1ab.zip
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
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 4 insertions, 2 deletions
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))
}()