Skip to content

Commit

Permalink
fix: close go-routines after session request has been answered (#4122)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateo-ivc authored and Benedict Homuth committed May 16, 2024
1 parent 263883a commit 89750b8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions server/src/api/board_session_requests_listen_on_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ func (s *Server) listenOnBoardSessionRequest(boardID, userID uuid.UUID, conn *we
}

func (b *BoardSessionRequestSubscription) startListeningOnBoardSessionRequest(userId uuid.UUID) {
for msg := range b.subscriptions[userId] {
logger.Get().Debugw("message received", "message", msg)
conn := b.clients[userId]
err := conn.WriteJSON(msg)
if err != nil {
logger.Get().Warnw("failed to send message", "message", msg, "err", err)
}
msg := <-b.subscriptions[userId]
logger.Get().Debugw("message received", "message", msg)
conn := b.clients[userId]
err := conn.WriteJSON(msg)
if err != nil {
logger.Get().Warnw("failed to send message", "message", msg, "err", err)
}
}

Expand Down

0 comments on commit 89750b8

Please sign in to comment.